Package org.eclipse.xsd

Examples of org.eclipse.xsd.XSDElementDeclaration


        FeatureTypeInfo lines = getFeatureTypeInfo(MockData.LINES);
        XSDSchema schema = builder.build(new FeatureTypeInfo[] { lines }, null);

        assertNotNull(schema);
        XSDElementDeclaration element = Schemas.getElementDeclaration(schema,
                MockData.LINES);
        assertNotNull(element);

        assertTrue(element.getType() instanceof XSDComplexTypeDefinition);

        XSDElementDeclaration id = Schemas.getChildElementDeclaration(element,
                new QName(MockData.CGF_URI, "id"));
        assertNotNull(id);

        XSDElementDeclaration lineStringProperty = Schemas
                .getChildElementDeclaration(element, new QName(
                        MockData.CGF_URI,
                        "lineStringProperty"));
        assertNotNull(lineStringProperty);

        XSDTypeDefinition lineStringPropertyType = lineStringProperty.getType();
        assertEquals(GML.NAMESPACE, lineStringPropertyType.getTargetNamespace());
        assertEquals(GML.LINESTRINGPROPERTYTYPE.getLocalPart(),
                lineStringPropertyType.getName());

        XSDTypeDefinition geometryAssociationType = lineStringPropertyType
View Full Code Here


   * <!-- end-user-doc -->
   * @generated
   */
  public void setElementDeclaration(XSDElementDeclaration newElementDeclaration)
  {
    XSDElementDeclaration oldElementDeclaration = elementDeclaration;
    elementDeclaration = newElementDeclaration;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(
        this,
        Notification.SET,
View Full Code Here

          niceSetAttributeURIValue(theElement, WSDLConstants.TYPE_ATTRIBUTE, typeDefinition.getURI());
        }
      }
      if (eReference == null || eReference == WSDLPackage.Literals.PART__ELEMENT_DECLARATION)
      {
        XSDElementDeclaration elementDecl = getElementDeclaration();
        if (elementDecl != null)
        {
          niceSetAttributeURIValue(theElement, WSDLConstants.ELEMENT_ATTRIBUTE, elementDecl.getURI());
        }
      }
    }
  }
View Full Code Here

    return newElement;
  }

  public void reconcileReferences(boolean deep)
  {
    XSDElementDeclaration newElementDeclaration = resolveElementDeclaration(elementName);
    if (newElementDeclaration != elementDeclaration)
    {
      setElementDeclaration(newElementDeclaration);
    }
View Full Code Here

    super.reconcileReferences(deep);
  }

  private XSDElementDeclaration resolveElementDeclaration(QName qname)
  {
    XSDElementDeclaration result = null;
    if (qname != null)
    {
      DefinitionImpl definition = (DefinitionImpl)getEnclosingDefinition();
      if (definition != null)
      {
View Full Code Here

    return list;
  }

  public XSDElementDeclaration resolveElementDeclarationURI(String uri)
  {
    XSDElementDeclaration result = null;
    int index = uri.lastIndexOf("#");
    if (index != -1)
    {
      result = resolveElementDeclaration(uri.substring(0, index), uri.substring(index + 1));
    }
View Full Code Here

    return component != null && component.getContainer() != null;
  }

  public XSDElementDeclaration resolveElementDeclaration(String namespace, String localName)
  {
    XSDElementDeclaration result = null;
    for (Iterator i = resolveSchema(namespace).iterator(); i.hasNext();)
    {
      XSDSchema schema = (XSDSchema)i.next();
      result = schema.resolveElementDeclaration(namespace, localName);
      if (isComponentDefined(result))
View Full Code Here

        //element whose type is set as 'this type'.  Otherwise when setting the type for the element
        //there will be a duplicate prefix (like Q1 or Q2... ) that will be created
        prefix = addImports((XSDSchema)schemaMap.get(targetNamespace), elementSchemaType);
       
        //XmlSchemaElement element = new XmlSchemaElement();
        XSDElementDeclaration element = xsdFactory.createXSDElementDeclaration();
        element.setName(aProperty.getName());
        
        XSDParticle aParticle = xsdFactory.createXSDParticle();
        aParticle.setContent(element);
       
        ((XSDModelGroup)((XSDParticle)complexType.getContent()).getContent()).
        getContents().add(aParticle);
       
        element.updateElement();

        if ( aProperty.isMany() )
        {
            aParticle.setMaxOccurs(-1);
            aParticle.setMinOccurs(0);
           
        }
       
        if ( aProperty.isContainment() )
        {
            element.setTypeDefinition(typeTable.getXSDTypeDef(elementSchemaType.getNamespaceURI(),
                                                                elementSchemaType.getLocalPart()));
        }
        else
        {
            if ( !aProperty.getType().isDataType() )
            {
                QName qName = typeTable.getSimpleSchemaTypeName("URI");
                element.setTypeDefinition(typeTable.getXSDTypeDef(qName.getNamespaceURI(),
                                            qName.getLocalPart()));
            }
        }
       
        addAnnotations(element, aProperty);
        if ( !aProperty.isContainment() && !aProperty.getType().isDataType() )
        {
            String value = prefix + COLON + elementSchemaType.getLocalPart();
            element.getElement().setAttribute(PROPERTY_TYPE, value);
        }
        return elementSchemaType;
       
    }
View Full Code Here

   
    private void createGlobalElement(XSDSchema xmlSchema,
                                         XSDComplexTypeDefinition complexType,
                                         QName schemaElementName )
    {
        XSDElementDeclaration globalElement = xsdFactory.createXSDElementDeclaration();
        globalElement.setTargetNamespace(xmlSchema.getTargetNamespace());
        globalElement.setName(formGlobalElementName(complexType.getName()));
        globalElement.setTypeDefinition
            (typeTable.getXSDTypeDef(schemaElementName.getNamespaceURI(),
                                                    schemaElementName.getLocalPart()));
        xmlSchema.getContents().add(globalElement);
        xmlSchema.getElementDeclarations().add(globalElement);
    }
View Full Code Here

              // particleMap.put(xsdParticle, eStructuralFeature);
            }
          }
          else
          {
            XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration)xsdTerm;

            boolean isRedundant = false;
            if (isRestriction)
            {
              isRedundant =
                extendedMetaData.getElement
                  (baseClass, xsdElementDeclaration.getTargetNamespace(), xsdElementDeclaration.getName()) != null;
             
              if (!isRedundant)
              {
                group =
                  extendedMetaData.getElementWildcardAffiliation
                    (baseClass, xsdElementDeclaration.getTargetNamespace(), xsdElementDeclaration.getName());
             
            }

            if (!isRedundant)
            {
              if (name == null)
              {
                name = getEcoreAttribute(xsdElementDeclaration, "name");
                if (name == null)
                {
                  name = validName(xsdElementDeclaration.getName(), true);
                }
              }

              String groupName = getEcoreAttribute(xsdParticle, "featureMap");
              if (groupName == null)
              {
                groupName = getEcoreAttribute(xsdElementDeclaration, "featureMap");
              }

              if (!"".equals(groupName) &&
                   (groupName != null  ||
                      xsdElementDeclaration.isAbstract() ||
                      xsdElementDeclaration.getSubstitutionGroup().size() > 1))
              {
                if (groupName == null)
                {
                  groupName = name + "Group";
                }
                eStructuralFeature =
                  createFeature
                    (eClass,
                     groupName,
                     ecorePackage.getEFeatureMapEntry(),
                     xsdParticle,
                     effectiveOccurrence.minOccurs,
                     effectiveOccurrence.maxOccurs);

                eStructuralFeature.setChangeable(true);

                extendedMetaData.setFeatureKind(eStructuralFeature, ExtendedMetaData.GROUP_FEATURE);
                extendedMetaData.setName(eStructuralFeature, xsdElementDeclaration.getName() + ":group");

                if (group != null)
                {
                  extendedMetaData.setGroup(eStructuralFeature, group);
                  eStructuralFeature.setDerived(true);
View Full Code Here

TOP

Related Classes of org.eclipse.xsd.XSDElementDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.