Package org.eclipse.xsd

Examples of org.eclipse.xsd.XSDComplexTypeDefinition


            {
                typeTable.addComplexSchemaType(aProperty.getType().getURI(),
                                                aProperty.getType().getName(),
                                                attributeSchemaType);
               
                XSDComplexTypeDefinition extComplexType = xsdFactory.createXSDComplexTypeDefinition();
                extComplexType.setName(aProperty.getType().getName());
                extComplexType.setTargetNamespace(aProperty.getType().getURI());
                typeTable.addXSDTypeDef(attributeSchemaType.getNamespaceURI(),
                                        attributeSchemaType.getLocalPart(),
                                        extComplexType);
            }
            includeExtXSD(aProperty.getType());
View Full Code Here


            else
            {
                typeTable.addComplexSchemaType(aProperty.getType().getURI(),
                                                aProperty.getType().getName(),
                                                elementSchemaType);
                XSDComplexTypeDefinition extComplexType = xsdFactory.createXSDComplexTypeDefinition();
                extComplexType.setName(aProperty.getType().getName());
                extComplexType.setTargetNamespace(aProperty.getType().getURI());
                typeTable.addXSDTypeDef(elementSchemaType.getNamespaceURI(),
                                        elementSchemaType.getLocalPart(),
                                        extComplexType);
            }
            includeExtXSD(aProperty.getType());
View Full Code Here

           
            complexSchemaTypeName = new QName(targetNamespace,
                                                dataType.getName(),
                                                targetNamespacePrefix);
           
            XSDComplexTypeDefinition complexType = xsdFactory.createXSDComplexTypeDefinition();
            complexType.setName(dataType.getName());
            complexType.setTargetNamespace(targetNamespace);    
            complexType.setAbstract(dataType.isAbstract());
           
            xmlSchema.getTypeDefinitions().add(complexType);
            xmlSchema.getContents().add(complexType);
           
            complexType.updateElement();
           
            addAnnotations(complexType, dataType);
           
            handleBaseExtn(xmlSchema, dataType, complexType);
            handleSDOSequence(dataType, complexType);
View Full Code Here

        }
       
        //build the type manually
        SimpleFeatureType featureType = (SimpleFeatureType) featureTypeInfo.getFeatureType();
       
        XSDComplexTypeDefinition complexType = factory.createXSDComplexTypeDefinition();
        complexType.setName(name+ "Type");

        complexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
        complexType.setBaseTypeDefinition(
            schema.resolveComplexTypeDefinition(GML.NAMESPACE, "AbstractFeatureType"));

        XSDModelGroup group = factory.createXSDModelGroup();
        group.setCompositor(XSDCompositor.SEQUENCE_LITERAL);

        List attributes = featureType.getAttributeDescriptors();
       
        for (int i = 0; i < attributes.size(); i++) {
            AttributeDescriptor attribute = (AttributeDescriptor) attributes.get(i);
            if ( filterAttributeType( attribute ) ) {
                continue;
            }
           
          
            XSDElementDeclaration element = factory.createXSDElementDeclaration();
            element.setName(attribute.getLocalName());
            element.setNillable(attribute.isNillable());

           
            Class binding = attribute.getType().getBinding();
            Name typeName = findTypeName(binding);

            if (typeName == null) {
                throw new NullPointerException("Could not find a type for property: "
                    + attribute.getName() + " of type: " + binding.getName());
            }

            XSDTypeDefinition type = index.getTypeDefinition( new QName( typeName.getNamespaceURI(), typeName.getLocalPart() ) );
            if ( type == null ) {
                throw new IllegalStateException( "Could not find type: " + typeName );
            }
            //XSDTypeDefinition type = schema.resolveTypeDefinition(typeName.getNamespaceURI(),
            //        typeName.getLocalPart());
            element.setTypeDefinition(type);

            XSDParticle particle = factory.createXSDParticle();
            particle.setMinOccurs(attribute.getMinOccurs());
            particle.setMaxOccurs(attribute.getMaxOccurs());
            particle.setContent(element);
            group.getContents().add(particle);
        }

        XSDParticle particle = factory.createXSDParticle();
        particle.setContent(group);

        complexType.setContent(particle);

        schema.getContents().add(complexType);

        XSDElementDeclaration element = factory.createXSDElementDeclaration();
        element.setName(name);
View Full Code Here

    private void buildSchemaContent(FeatureTypeInfo featureTypeMeta, XSDSchema schema,
            XSDFactory factory, String baseUrl)
            throws IOException {
        if (!findTypeInSchema(featureTypeMeta, schema, factory)) {
            // build the type manually
            XSDComplexTypeDefinition xsdComplexType = buildComplexSchemaContent(featureTypeMeta
                    .getFeatureType(), schema, factory);

            XSDElementDeclaration element = factory.createXSDElementDeclaration();
            element.setName(featureTypeMeta.getName());
View Full Code Here

     * @param factory
     * @return
     */
    private XSDComplexTypeDefinition buildComplexSchemaContent(ComplexType complexType,
            XSDSchema schema, XSDFactory factory) {
        XSDComplexTypeDefinition xsdComplexType = factory.createXSDComplexTypeDefinition();
        xsdComplexType.setName(complexType.getName().getLocalPart() + "Type");

        xsdComplexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
        xsdComplexType.setBaseTypeDefinition(schema.resolveComplexTypeDefinition(gmlNamespace,
                baseType));

        XSDModelGroup group = factory.createXSDModelGroup();
        group.setCompositor(XSDCompositor.SEQUENCE_LITERAL);

        for (PropertyDescriptor pd : complexType.getDescriptors()) {
            if (pd instanceof AttributeDescriptor) {
                AttributeDescriptor attribute = (AttributeDescriptor) pd;

                if ( filterAttributeType( attribute ) ) {
                    continue;
                }

                XSDElementDeclaration element = factory.createXSDElementDeclaration();
                element.setName(attribute.getLocalName());
                element.setNillable(attribute.isNillable());

                Name typeName = attribute.getType().getName();
                // skip if it's XS.AnyType. It's not added to XS.Profile, because
                // a lot of types extend XS.AnyType causing it to be the returned
                // binding.. I could make it so that it checks against all profiles
                // but would that slow things down? At the moment, it returns the
                // first matching one, so it doesn't go through all profiles.
                if (!(typeName.getLocalPart().equals(XS.ANYTYPE.getLocalPart()) && typeName
                        .getNamespaceURI().equals(XS.NAMESPACE))) {
                    if (attribute.getType() instanceof ComplexType) {
                        // If non-simple complex property not in schema, recurse.
                        // Note that abstract types will of course not be resolved; these must be
                        // configured at global level, so they can be found by the
                        // encoder.
                        if (schema.resolveTypeDefinition(typeName.getNamespaceURI(), typeName
                                .getLocalPart()) == null) {
                            buildComplexSchemaContent((ComplexType) attribute.getType(), schema,
                                    factory);
                        }
                    } else {
                        Class binding = attribute.getType().getBinding();
                        typeName = findTypeName(binding);
                        if (typeName == null) {
                            throw new NullPointerException("Could not find a type for property: "
                                    + attribute.getName() + " of type: " + binding.getName());

                        }
                    }
                }

                XSDTypeDefinition type = schema.resolveTypeDefinition(typeName.getNamespaceURI(),
                        typeName.getLocalPart());
                element.setTypeDefinition(type);

                XSDParticle particle = factory.createXSDParticle();
                particle.setMinOccurs(attribute.getMinOccurs());
                particle.setMaxOccurs(attribute.getMaxOccurs());
                particle.setContent(element);
                group.getContents().add(particle);
            }
        }

        XSDParticle particle = factory.createXSDParticle();
        particle.setContent(group);

        xsdComplexType.setContent(particle);

        schema.getContents().add(xsdComplexType);
        return xsdComplexType;
    }
View Full Code Here

            {
                typeTable.addComplexSchemaType(aProperty.getType().getURI(),
                                                aProperty.getType().getName(),
                                                attributeSchemaType);
               
                XSDComplexTypeDefinition extComplexType = xsdFactory.createXSDComplexTypeDefinition();
                extComplexType.setName(aProperty.getType().getName());
                extComplexType.setTargetNamespace(aProperty.getType().getURI());
                typeTable.addXSDTypeDef(attributeSchemaType.getNamespaceURI(),
                                        attributeSchemaType.getLocalPart(),
                                        extComplexType);
            }
            includeExtXSD(aProperty.getType());
View Full Code Here

            else
            {
                typeTable.addComplexSchemaType(aProperty.getType().getURI(),
                                                aProperty.getType().getName(),
                                                elementSchemaType);
                XSDComplexTypeDefinition extComplexType = xsdFactory.createXSDComplexTypeDefinition();
                extComplexType.setName(aProperty.getType().getName());
                extComplexType.setTargetNamespace(aProperty.getType().getURI());
                typeTable.addXSDTypeDef(elementSchemaType.getNamespaceURI(),
                                        elementSchemaType.getLocalPart(),
                                        extComplexType);
            }
            includeExtXSD(aProperty.getType());
View Full Code Here

           
            complexSchemaTypeName = new QName(targetNamespace,
                                                dataType.getName(),
                                                targetNamespacePrefix);
           
            XSDComplexTypeDefinition complexType = xsdFactory.createXSDComplexTypeDefinition();
            complexType.setName(dataType.getName());
            complexType.setTargetNamespace(targetNamespace);    
            complexType.setAbstract(dataType.isAbstract());
           
            xmlSchema.getTypeDefinitions().add(complexType);
            xmlSchema.getContents().add(complexType);
           
            complexType.updateElement();
           
            addAnnotations(complexType, dataType);
           
            handleBaseExtn(xmlSchema, dataType, complexType);
            handleSDOSequence(dataType, complexType);
View Full Code Here

    XSDWildcard baseXSDWildcard = null;
    Collection baseAttributeUses = Collections.EMPTY_LIST;
    Map baseAttributeURIs = new HashMap();
    if (baseTypeDefinition instanceof XSDComplexTypeDefinition)
    {
      XSDComplexTypeDefinition complexBaseTypeDefinition = (XSDComplexTypeDefinition)baseTypeDefinition;
      baseXSDWildcard = complexBaseTypeDefinition.getAttributeWildcard();
      baseAttributeUses = complexBaseTypeDefinition.getAttributeUses();
      for (Iterator i = baseAttributeUses.iterator(); i.hasNext(); )
      {
        XSDAttributeUse xsdAttributeUse = (XSDAttributeUse)i.next();
        baseAttributeURIs.put(xsdAttributeUse.getAttributeDeclaration().getURI(), xsdAttributeUse);
      }
View Full Code Here

TOP

Related Classes of org.eclipse.xsd.XSDComplexTypeDefinition

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.