Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSComplexTypeDefinition


       Object assertObject = null;
           
       if (typeDef.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
          // if element's governing type is a "complex type"
          XSObjectListImpl assertions = new XSObjectListImpl();               
          XSComplexTypeDefinition complexTypeDef = (XSComplexTypeDefinition) typeDef;
         
          XSObjectList complexTypeAsserts = complexTypeDef.getAssertions();
          if (complexTypeAsserts.getLength() > 0) {
            for (int i = 0; i < complexTypeAsserts.getLength(); i++) {
               assertions.addXSObject((XSAssert)complexTypeAsserts.get(i));
            }
          }
         
          // add assertion facets, from "complexType -> simpleContent -> restriction"
          XSSimpleTypeDefinition simpleTypeDef = complexTypeDef.getSimpleType();
          if (simpleTypeDef != null) {
            XSObjectList complexTypeFacets = simpleTypeDef.getMultiValueFacets();
            for (int i = 0; i < complexTypeFacets.getLength(); i++) {
              XSMultiValueFacet facet = (XSMultiValueFacet) complexTypeFacets.item(i);
              if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT) {
View Full Code Here


            case SIMPLE_TYPE: {
                final XSSimpleTypeDefinition simpleTypeDefinition = (XSSimpleTypeDefinition) typeDefinition;
                return new Node(parent, new QName(xsElement.getNamespace(), xsElement.getName()), convert(simpleTypeDefinition));
            }
            case COMPLEX_TYPE: {
                final XSComplexTypeDefinition complexTypeDefinition = (XSComplexTypeDefinition) typeDefinition;
                final Node element = new Node(parent, new QName(xsElement.getNamespace(), xsElement.getName()), new HashSet<Node>(), new ArrayList<Node>());

                final XSObjectList attributeUses = complexTypeDefinition.getAttributeUses();
                for (final Object attributeObject : attributeUses) {
                    final XSAttributeUse attributeUse = (XSAttributeUse) attributeObject;
                    final XSAttributeDeclaration attributeDeclaration = attributeUse.getAttrDeclaration();

                    log.trace("Attribute {{}}{}", attributeDeclaration.getNamespace(), attributeDeclaration.getName());
                    final Node attribute = new Node(element, new QName(attributeDeclaration.getNamespace(), attributeDeclaration.getName()), convert(attributeDeclaration.getTypeDefinition()));
                    element.attributes.add(attribute);
                }

                final XSParticle particle = complexTypeDefinition.getParticle();
                if (particle != null) {
                    generateParticle(particle, element);
                }
                return element;
            }
View Full Code Here

                .loadURI(getResourceURL("XSFacetTest01.xsd"));

        XSElementDeclaration elem = model.getElementDeclaration("elem4",
                "XSFacetTest");

        XSComplexTypeDefinition ct = (XSComplexTypeDefinition) elem
                .getTypeDefinition();
        XSAttributeUse attr = (XSAttributeUse) ct.getAttributeUses().item(0);
        XSSimpleTypeDefinition st = attr.getAttrDeclaration()
                .getTypeDefinition();
        // Item 0 is minInclusive
        XSFacet fractionDigits = (XSFacet) st.getFacets().item(1);
View Full Code Here

                        synth);

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSParticleTest01.xsd"));

        XSComplexTypeDefinition ct = (XSComplexTypeDefinition) model
                .getTypeDefinition("CT1", "XSParticleTest");

        XSModelGroup sequence = (XSModelGroup) ct.getParticle().getTerm();
        XSParticle element = (XSParticle) sequence.getParticles().item(0);
        XSObjectList annotations = element.getAnnotations();
        assertEquals("TEST1_NO_ANNOTATIONS_" + synth, 0, annotations
                .getLength());
View Full Code Here

                        synth);

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSParticleTest01.xsd"));

        XSComplexTypeDefinition ct = (XSComplexTypeDefinition) model
                .getTypeDefinition("CT2", "XSParticleTest");

        XSModelGroup sequence = (XSModelGroup) ct.getParticle().getTerm();
        XSParticle element = (XSParticle) sequence.getParticles().item(0);
        XSObjectList annotations = element.getAnnotations();
        assertEquals("TEST2_NO_ANNOTATIONS_" + synth, (synth.booleanValue() == true) ? 1 : 0,
                annotations.getLength());
View Full Code Here

                        synth);

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSParticleTest01.xsd"));

        XSComplexTypeDefinition ct = (XSComplexTypeDefinition) model
                .getTypeDefinition("CT3", "XSParticleTest");

        XSParticle all = ct.getParticle();
        XSObjectList annotations = all.getAnnotations();
        assertEquals("TEST3_ANNOTATIONS_" + synth, (synth.booleanValue() == true) ? 1 : 0, annotations
                .getLength());
        if ((synth.booleanValue() == true))
            assertEquals("TEST3_ANNOTATIONS_" + synth, expected,
View Full Code Here

                expected2,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        XSElementDeclaration elementDecl = (XSElementDeclaration) element
                .getTerm();
        XSComplexTypeDefinition ct = (XSComplexTypeDefinition) elementDecl
                .getTypeDefinition();
        XSParticle choice = ct.getParticle();
        annotations = choice.getAnnotations();
        assertEquals(
                "TEST4_ANNOTATIONS_3_" + synth,
                expected3,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));
View Full Code Here

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSParticleTest01.xsd"));

        XSElementDeclaration elem1 = model.getElementDeclaration("elem1",
                "XSParticleTest");
        XSComplexTypeDefinition ct = (XSComplexTypeDefinition) elem1
                .getTypeDefinition();
        XSComplexTypeDefinition ctb = (XSComplexTypeDefinition) ct
                .getBaseType();
        XSParticle sequence = ctb.getParticle();
        XSModelGroup sequencegrp = (XSModelGroup) sequence.getTerm();
        XSParticle elem2 = (XSParticle) sequencegrp.getParticles().item(0);
        XSElementDeclaration elemDecl2 = (XSElementDeclaration) elem2.getTerm();

        XSObjectList annotations = elem2.getAnnotations();
View Full Code Here

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSParticleTest01.xsd"));

        XSElementDeclaration elem1 = model.getElementDeclaration("elem2",
                "XSParticleTest");
        XSComplexTypeDefinition ct = (XSComplexTypeDefinition) elem1
                .getTypeDefinition();
        XSParticle sequence = ct.getParticle();
        XSModelGroup sequencegrp = (XSModelGroup) sequence.getTerm();

        XSParticle elem2 = (XSParticle) sequencegrp.getParticles().item(0);
        XSElementDeclaration elemDecl2 = (XSElementDeclaration) elem2.getTerm();
        XSObjectList annotations = elem2.getAnnotations();
View Full Code Here

                        synth);

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSParticleTest01.xsd"));

        XSComplexTypeDefinition ct = (XSComplexTypeDefinition) model
                .getTypeDefinition("CT4", "XSParticleTest");
        XSParticle choice = ct.getParticle();

        XSObjectList annotations = choice.getAnnotations();
        assertEquals(
                "TEST7_ANNOTATIONS_1_" + synth,
                expected,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        XSModelGroup mg = (XSModelGroup) choice.getTerm();
        annotations = mg.getAnnotations();
        assertEquals(
                "TEST7_ANNOTATIONS_2_" + synth,
                expected,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        XSParticle seq = (XSParticle) mg.getParticles().item(0);
        annotations = seq.getAnnotations();
        assertEquals(
                "TEST7_ANNOTATIONS_3_" + synth,
                expected1,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));
        mg = (XSModelGroup) seq.getTerm();
        annotations = mg.getAnnotations();
        assertEquals(
                "TEST7_ANNOTATIONS_4_" + synth,
                expected1,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        XSParticle elem1 = (XSParticle) mg.getParticles().item(0);
        annotations = elem1.getAnnotations();
        assertEquals(
                "TEST7_ANNOTATIONS_5_" + synth,
                expected2,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));
        XSElementDeclaration elem = (XSElementDeclaration) elem1.getTerm();
        XSComplexTypeDefinition ct2 = (XSComplexTypeDefinition) elem
                .getTypeDefinition();
        XSParticle all = ct2.getParticle();
        annotations = all.getAnnotations();
        assertEquals(
                "TEST7_ANNOTATIONS_6_" + synth,
                expected3,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));
View Full Code Here

TOP

Related Classes of org.apache.xerces.xs.XSComplexTypeDefinition

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.