Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSModelGroup


   }

   private void bindGlobalGroup(XSModelGroupDefinition groupDef)
   {
      QName groupName = new QName(groupDef.getNamespace(), groupDef.getName());
      XSModelGroup group = groupDef.getModelGroup();
      ModelGroupBinding groupBinding = bindModelGroup(group);
      groupBinding.setQName(groupName);
      sharedElements.addGlobalGroup(group, groupBinding);
      schema.addGroup(groupName, groupBinding);
   }
View Full Code Here


                .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());

        XSParticle any = (XSParticle) sequence.getParticles().item(1);
        annotations = any.getAnnotations();
        assertEquals("TEST1_NO_ANNOTATIONS_" + synth, 0, annotations
                .getLength());

        XSParticle choice = (XSParticle) sequence.getParticles().item(1);
        annotations = choice.getAnnotations();
        assertEquals("TEST1_NO_ANNOTATIONS_" + synth, 0, annotations
                .getLength());
    }
View Full Code Here

                .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());

        XSParticle any = (XSParticle) sequence.getParticles().item(1);
        annotations = any.getAnnotations();
        assertEquals("TEST2_NO_ANNOTATIONS_" + synth, (synth.booleanValue() == true) ? 1 : 0,
                annotations.getLength());

        XSParticle choice = (XSParticle) sequence.getParticles().item(1);
        annotations = choice.getAnnotations();
        assertEquals("TEST2_NO_ANNOTATIONS_" + synth, (synth.booleanValue() == true) ? 1 : 0,
                annotations.getLength());
    }
View Full Code Here

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

        XSModelGroupDefinition mgd = model.getModelGroupDefinition("GRP4",
                "XSParticleTest");
        XSModelGroup all = mgd.getModelGroup();

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

        XSParticle element = (XSParticle) all.getParticles().item(0);
        annotations = element.getAnnotations();
        assertEquals(
                "TEST4_ANNOTATIONS_2_" + synth,
                expected2,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));
View Full Code Here

        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();
        assertEquals(
                "TEST5_ANNOTATIONS_1_" + synth,
                expected,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        annotations = elemDecl2.getAnnotations();
        assertEquals(
                "TEST5_ANNOTATIONS_2_" + synth,
                expected2,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        if ((synth.booleanValue() == true)) {
            XSParticle elem3 = (XSParticle) sequencegrp.getParticles().item(1);
            XSElementDeclaration elemDecl3 = (XSElementDeclaration) elem3
                    .getTerm();

            annotations = elem3.getAnnotations();
            assertEquals("TEST5_ANNOTATIONS_3_" + synth, 0, annotations
View Full Code Here

        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();
        assertEquals(
                "TEST6_ANNOTATIONS_1_" + synth,
                expected,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        annotations = elemDecl2.getAnnotations();
        assertEquals(
                "TEST6_ANNOTATIONS_2_" + synth,
                expected2,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        if (synth.booleanValue() == true) {
            XSParticle elem3 = (XSParticle) sequencegrp.getParticles().item(1);
            XSElementDeclaration elemDecl3 = (XSElementDeclaration) elem3
                    .getTerm();

            annotations = elem3.getAnnotations();
            assertEquals("TEST6_ANNOTATIONS_3_" + synth, 0, annotations
                    .getLength());

            annotations = elemDecl3.getAnnotations();
            assertEquals("TEST6_ANNOTATIONS_4_" + synth, expected3,
                    trim(((XSAnnotation) annotations.item(0))
                            .getAnnotationString()));
        }

        XSParticle elem3 = (XSParticle) sequencegrp.getParticles().item(2);
        XSElementDeclaration elemDecl3 = (XSElementDeclaration) elem3.getTerm();
        annotations = elem3.getAnnotations();
        assertEquals(
                "TEST6_ANNOTATIONS_1_" + synth,
                expected4,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        annotations = elemDecl3.getAnnotations();
        assertEquals(
                "TEST6_ANNOTATIONS_2_" + synth,
                expected5,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        if (synth.booleanValue() == true) {
            XSParticle elem4 = (XSParticle) sequencegrp.getParticles().item(3);
            XSElementDeclaration elemDecl4 = (XSElementDeclaration) elem4
                    .getTerm();

            annotations = elem4.getAnnotations();
            assertEquals("TEST6_ANNOTATIONS_3_" + synth, 1, annotations
                    .getLength());

            annotations = elemDecl4.getAnnotations();
            assertEquals("TEST6_ANNOTATIONS_4_" + synth, expected6,
                    trim(((XSAnnotation) annotations.item(0))
                            .getAnnotationString()));
        }

        XSParticle any = (XSParticle) sequencegrp.getParticles().item(4);
        annotations = any.getAnnotations();
        assertEquals(
                "TEST6_ANNOTATIONS_1_" + synth,
                expected7,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));
View Full Code Here

        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()));
        mg = (XSModelGroup) all.getTerm();
        annotations = mg.getAnnotations();
        assertEquals(
                "TEST7_ANNOTATIONS_7_" + synth,
                expected3,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        XSParticle seq2 = (XSParticle) mg.getParticles().item(0);
        annotations = seq2.getAnnotations();
        assertEquals(
                "TEST7_ANNOTATIONS_8_" + synth,
                expected4,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        mg = (XSModelGroup) seq.getTerm();
        XSParticle any = (XSParticle) mg.getParticles().item(1);
        annotations = any.getAnnotations();
        assertEquals(
                "TEST7_ANNOTATIONS_9_" + synth,
                expected5,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));
View Full Code Here

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSModelGroupTest01.xsd"));
        XSModelGroupDefinition mgd = model.getModelGroupDefinition("group1",
                "XSModelGroup");

        XSModelGroup group = mgd.getModelGroup();

        XSAnnotation annotation = group.getAnnotation();
        assertNull("TEST1_NO_ANNOTATION", annotation);
        XSObjectList annotations = group.getAnnotations();
        assertEquals("TEST1_NO_ANNOTATIONS", 0, annotations.getLength());
    }
View Full Code Here

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

        XSModelGroupDefinition mgd = model.getModelGroupDefinition("group2",
                "XSModelGroup");
        XSModelGroup group = mgd.getModelGroup();

        XSAnnotation annotation = group.getAnnotation();
        assertNull("TEST2_NO_ANNOTATION", annotation);
        XSObjectList annotations = group.getAnnotations();
        assertEquals("TEST2_NO_ANNOTATIONS", 0, annotations.getLength());

        fConfig
                .setParameter(
                        "http://apache.org/xml/features/generate-synthetic-annotations",
                        Boolean.TRUE);

        model = fSchemaLoader
                .loadURI(getResourceURL("XSModelGroupTest01.xsd"));

        mgd = model.getModelGroupDefinition("group2", "XSModelGroup");
        group = mgd.getModelGroup();

        annotation = group.getAnnotation();
        assertNotNull("TEST2_SYNTH_ANNOTATION", annotation);
        annotations = group.getAnnotations();
        assertEquals("TEST2_SYNTH_ANNOTATIONS", 1, annotations.getLength());
    }
View Full Code Here

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

        XSModelGroupDefinition mgd = model.getModelGroupDefinition("group3",
                "XSModelGroup");
        XSModelGroup groupChoice = mgd.getModelGroup();
        XSParticle choiceparticle = (XSParticle) groupChoice.getParticles()
                .item(0);
        XSModelGroup group = (XSModelGroup) choiceparticle.getTerm();

        XSAnnotation annotation = group.getAnnotation();
        assertEquals("TEST3_NO_ANNOTATION_" + synth, expected, trim(annotation
                .getAnnotationString()));
        XSObjectList annotations = group.getAnnotations();
        assertEquals("TEST3_NO_ANNOTATIONS_" + synth, 1, annotations
                .getLength());
        assertEquals(
                "TEST3_NO_ANNOTATIONS_" + synth,
                expected,
View Full Code Here

TOP

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

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.