Package org.eclipse.xsd

Examples of org.eclipse.xsd.XSDParticle


       
        //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() )
        {
View Full Code Here


        if ( datatype.isSequenced()     )
        {
            complexType.setMixed(true);
            XSDModelGroup choice = xsdFactory.createXSDModelGroup();
            choice.setCompositor(XSDCompositor.CHOICE_LITERAL);
            XSDParticle aParticle = xsdFactory.createXSDParticle();
            aParticle.setContent(choice);
            aParticle.setMaxOccurs(-1);
            complexType.setContent(aParticle);
        }
        else
        {
            //hack to handle group property as choice
            /*if ( getPropertyStartsWithName(datatype.getDeclaredProperties(), GROUP).size() > 0 )
            {
                XmlSchemaChoice choice = new XmlSchemaChoice();
                choice.setMaxOccurs(Long.MAX_VALUE);
                complexType.setParticle(choice);
            }
            else*/
            {
                XSDModelGroup sequence = xsdFactory.createXSDModelGroup();
                sequence.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
                XSDParticle aParticle = xsdFactory.createXSDParticle();
                aParticle.setContent(sequence);
                complexType.setContent(aParticle);
            }
        }
    }
View Full Code Here

        {
            XSDWildcard elementWildcard = xsdFactory.createXSDWildcard();
            elementWildcard.getLexicalNamespaceConstraint().add("##other");
            elementWildcard.setProcessContents(XSDProcessContents.LAX_LITERAL);
            // Create a particle to hold the wildcard.
            XSDParticle wildcardParticle = xsdFactory.createXSDParticle();
            wildcardParticle.setContent(elementWildcard);
            wildcardParticle.setMaxOccurs(-1);
            ((XSDModelGroup)((XSDParticle)complexType.getContent()).getContent()).
                getContents().add(wildcardParticle);
              
            XSDWildcard attributeWildcard = xsdFactory.createXSDWildcard();
            attributeWildcard.getLexicalNamespaceConstraint().add("##other");
View Full Code Here

            //create a new particle based on the new type
            XSDElementDeclaration value = XSDFactory.eINSTANCE.createXSDElementDeclaration();
            value.setName("Value");
            value.setTypeDefinition(type);

            XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
            particle.setMinOccurs(1);
            particle.setMaxOccurs(1);
            particle.setContent(value);

            properties.add(new Object[] { particle, property.getValue() });
        } else {
            //coudl not determine new type, just fall back to xs:anyType
            Object[] p = new Object[] {
View Full Code Here

            }
            //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);
View Full Code Here

                        for ( Iterator c = children.iterator(); c.hasNext(); ) {
                            XSDElementDeclaration ce = (XSDElementDeclaration) c.next();
                            if ( at.getName().equals( ce.getName() ) ) {
                                found = true;
                                if (ce.getContainer() instanceof XSDParticle) {
                                    XSDParticle part = (XSDParticle) ce.getContainer();
                                    at.setMinOccurs(part.getMinOccurs());
                                    at.setMaxOccurs(part.getMaxOccurs());
                                }
                                break;
                            }
                        }
                       
View Full Code Here

                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

        element.setNillable(nillable);

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

        XSDParticle particle = factory.createXSDParticle();
        particle.setMinOccurs(minOccurs);
        particle.setMaxOccurs(maxOccurs);
        particle.setContent(element);
        return particle;
    }
View Full Code Here

       
        //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() )
        {
View Full Code Here

        if ( datatype.isSequenced()     )
        {
            complexType.setMixed(true);
            XSDModelGroup choice = xsdFactory.createXSDModelGroup();
            choice.setCompositor(XSDCompositor.CHOICE_LITERAL);
            XSDParticle aParticle = xsdFactory.createXSDParticle();
            aParticle.setContent(choice);
            aParticle.setMaxOccurs(-1);
            complexType.setContent(aParticle);
        }
        else
        {
            //hack to handle group property as choice
            /*if ( getPropertyStartsWithName(datatype.getDeclaredProperties(), GROUP).size() > 0 )
            {
                XmlSchemaChoice choice = new XmlSchemaChoice();
                choice.setMaxOccurs(Long.MAX_VALUE);
                complexType.setParticle(choice);
            }
            else*/
            {
                XSDModelGroup sequence = xsdFactory.createXSDModelGroup();
                sequence.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
                XSDParticle aParticle = xsdFactory.createXSDParticle();
                aParticle.setContent(sequence);
                complexType.setContent(aParticle);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.xsd.XSDParticle

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.