Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSAnnotation


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

        XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
                "XSAttributeAnnotationsTest");
        XSAnnotation annotation = attr.getAnnotation();

        String expectedResult = "<annotation id=\"ANNOT1\" "
                + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
                + "xmlns:sv=\"XSAttributeAnnotationsTest\" >"
                + "<appinfo source=\"None\">"
                + "<!-- No Appinfo -->"
                + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
                + "</annotation>";

        String actual = annotation.getAnnotationString();

        assertEquals(trim(expectedResult), trim(actual));
    }
View Full Code Here


                + "<!-- No Appinfo -->"
                + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
                + "</annotation>";

        for (int i = 0; i < annotations.getLength(); i++) {
            XSAnnotation annotation = (XSAnnotation) annotations.item(i);
            String actual = annotation.getAnnotationString();
            assertEquals(trim(expectedResult), trim(actual));
        }

        attr = model.getAttributeDeclaration("attr2",
                "XSAttributeAnnotationsTest");
        annotations = attr.getAnnotations();

        expectedResult = "<annotation id=\"ANNOT2\" "
                + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
                + "xmlns:sv=\"XSAttributeAnnotationsTest\" >" + "</annotation>";

        for (int i = 0; i < annotations.getLength(); i++) {
            XSAnnotation annotation = (XSAnnotation) annotations.item(i);
            String actual = annotation.getAnnotationString();
            assertEquals(trim(expectedResult), trim(actual));
        }
    }
View Full Code Here

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

        XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
                "XSAttributeAnnotationsTest");
        XSAnnotation annotation = attr.getAnnotation();

        assertNotNull("Synthetic Annotation Null", annotation);
    }
View Full Code Here

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

        XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
                "XSAttributeAnnotationsTest");
        XSAnnotation annotation = attr.getAnnotation();

        assertNull("Synthetic Annotation Not Null", annotation);
    }
View Full Code Here

        XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) model
                .getTypeDefinition("ST1", "XSFacetTest");
        // Item 0 is whitespace
        XSFacet length = (XSFacet) st.getFacets().item(1);

        XSAnnotation annotation = length.getAnnotation();
        assertNull("TEST1_NO_ANNOTATION_" + synth, annotation);
        XSObjectList annotations = length.getAnnotations();
        assertEquals("TEST1_NO_ANNOTATIONS_" + synth, 0, annotations
                .getLength());
    }
View Full Code Here

        XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) model
                .getTypeDefinition("ST2", "XSFacetTest");
        // Item 0 is whitespace
        XSFacet minLength = (XSFacet) st.getFacets().item(1);

        XSAnnotation annotation = minLength.getAnnotation();
        assertEquals("TEST2_NO_ANNOTATION_" + synth, expected, trim(annotation
                .getAnnotationString()));
        XSObjectList annotations = minLength.getAnnotations();
        assertEquals(
                "TEST2_NO_ANNOTATIONS_" + synth,
                expected,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        XSFacet maxLength = (XSFacet) st.getFacets().item(2);
        annotation = maxLength.getAnnotation();
        assertEquals("TEST2_NO_ANNOTATION_" + synth, expected2, trim(annotation
                .getAnnotationString()));
        annotations = maxLength.getAnnotations();
        assertEquals(
                "TEST2_NO_ANNOTATIONS_" + synth,
                expected2,
View Full Code Here

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

        XSAnnotation annotation = group.getAnnotation();
        assertEquals("TEST5.1_NO_ANNOTATION_" + synth, expected1,
                trim(annotation.getAnnotationString()));
        XSObjectList annotations = group.getAnnotations();
        assertEquals("TEST5.1_NO_ANNOTATIONS_" + synth, 1, annotations
                .getLength());
        assertEquals(
                "TEST5.1_NO_ANNOTATIONS_" + synth,
                expected1,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        group = (XSModelGroup) ((XSParticle) group.getParticles().item(0))
                .getTerm();
        annotation = group.getAnnotation();
        assertEquals("TEST5.2_NO_ANNOTATION_" + synth, expected2,
                trim(annotation.getAnnotationString()));
        annotations = group.getAnnotations();
        assertEquals("TEST5.2_NO_ANNOTATIONS_" + synth, 1, annotations
                .getLength());
        assertEquals(
                "TEST5.2_NO_ANNOTATIONS_" + synth,
View Full Code Here

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

        XSAnnotation annotation = group.getAnnotation();
        assertEquals("TEST6.1_NO_ANNOTATION_" + synth, expected1,
                trim(annotation.getAnnotationString()));
        XSObjectList annotations = group.getAnnotations();
        assertEquals("TEST6.1_NO_ANNOTATIONS_" + synth, 1, annotations
                .getLength());
        assertEquals(
                "TEST6.1_NO_ANNOTATIONS_" + synth,
                expected1,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        group = (XSModelGroup) ((XSParticle) group.getParticles().item(0))
                .getTerm();
        annotation = group.getAnnotation();
        assertEquals("TEST6.2_NO_ANNOTATION_" + synth, expected2,
                trim(annotation.getAnnotationString()));
        annotations = group.getAnnotations();
        assertEquals("TEST6.2_NO_ANNOTATIONS_" + synth, 1, annotations
                .getLength());
        assertEquals(
                "TEST6.2_NO_ANNOTATIONS_" + synth,
                expected2,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        group = (XSModelGroup) ((XSParticle) group.getParticles().item(0))
                .getTerm();
        annotation = group.getAnnotation();
        assertEquals("TEST6.3_NO_ANNOTATION_" + synth, expected3,
                trim(annotation.getAnnotationString()));
        annotations = group.getAnnotations();
        assertEquals("TEST6.3_NO_ANNOTATIONS_" + synth, 1, annotations
                .getLength());
        assertEquals(
                "TEST6.3_NO_ANNOTATIONS_" + synth,
View Full Code Here

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

        XSAnnotation annotation = group.getAnnotation();
        assertEquals("TEST7.1_ANNOTATION_" + synth, expected1,
                trim(annotation.getAnnotationString()));
        XSObjectList annotations = group.getAnnotations();
        assertEquals("TEST7.1_ANNOTATIONS_" + synth, 1, annotations
                .getLength());
        assertEquals(
                "TEST7.1_ANNOTATIONS_" + synth,
                expected1,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        if (synth == Boolean.TRUE) {
            group = (XSModelGroup) ((XSParticle) group.getParticles().item(0))
                    .getTerm();
            annotation = group.getAnnotation();
            assertEquals("TEST7.2_ANNOTATION_" + synth, expected2,
                    trim(annotation.getAnnotationString()));
            annotations = group.getAnnotations();
            assertEquals("TEST7.2_ANNOTATIONS_" + synth, 1, annotations
                    .getLength());
            assertEquals("TEST7.2_ANNOTATIONS_" + synth, expected2,
                    trim(((XSAnnotation) annotations.item(0))
View Full Code Here

        XSComplexTypeDefinition ct = (XSComplexTypeDefinition) model
                .getTypeDefinition("CT1", "XSModelGroup");
        XSParticle particle = ct.getParticle();
        XSModelGroup group = (XSModelGroup) particle.getTerm();

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

TOP

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

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.