Package org.apache.ws.commons.schema

Examples of org.apache.ws.commons.schema.XmlSchemaEnumerationFacet


                }
                metaInfHolder.setPatternFacet(patternString);
            }

            else if (obj instanceof XmlSchemaEnumerationFacet) {
                XmlSchemaEnumerationFacet enumeration = (XmlSchemaEnumerationFacet) obj;
                if (restriction.getBaseTypeName().equals(SchemaConstants.XSD_QNAME)) {
                    // we have to process the qname here and shoud find the local part and namespace uri
                    String value = enumeration.getValue().toString();
                    String prefix = value.substring(0, value.indexOf(":"));
                    String localPart = value.substring(value.indexOf(":") + 1);

                    String namespaceUri = parentSchema.getNamespaceContext().getNamespaceURI(prefix);
                    // set the string to suite for the convertQname method
                    String qNameString = value + "\", \"" + namespaceUri;
                    metaInfHolder.addEnumFacet(qNameString);
                } else {
                    metaInfHolder.addEnumFacet(enumeration.getValue().toString());
                }

            }

            else if (obj instanceof XmlSchemaLengthFacet) {
View Full Code Here


        XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) content;
        XmlSchemaObjectCollection facets = restriction.getFacets();
        List<String> values = new ArrayList<String>();
        for (int x = 0; x < facets.getCount(); x++) {
            XmlSchemaFacet facet = (XmlSchemaFacet) facets.getItem(x);
            XmlSchemaEnumerationFacet enumFacet = (XmlSchemaEnumerationFacet) facet;
            values.add(enumFacet.getValue().toString());
        }
        return values;
    }
View Full Code Here

        assertEquals(2, xsoc.getCount());
        Set s = new HashSet();
        s.add("tns:teamLogo");
        s.add("tns:teamMascot");
        for (int i = 0; i < xsoc.getCount(); i++) {
            XmlSchemaEnumerationFacet xsef =
                (XmlSchemaEnumerationFacet)xsoc.getItem(i);
            String value = (String)xsef.getValue();
            if (!(value.equals("tns:teamLogo")
                   || value.equals("tns:teamMascot"))) {
                fail("An unexpected value of \"" + value
                     + "\" was found.");
            }
View Full Code Here

        Set s = new HashSet();
        s.add("Field");
        s.add("Separator");
        for (Iterator i  = collection.getIterator(); i.hasNext(); ) {
            XmlSchemaEnumerationFacet xsef = (XmlSchemaEnumerationFacet)i.next();
            String value = (String)xsef.getValue();
            assertTrue("Atempted to remove an enumeration with the value of "
                       + "\"" + value + "\", but the value was not in the set.",
                       s.remove(value));
            String toStr = xsef.toString("xsd", 1);
            if (value.equals("Field")) {
                assertTrue("The toString(String, int) method did not contain "
                           + "\"enumeration\", but did contain: " + toStr,
                           toStr.indexOf("enumeration value=\"Field\"") != -1);
            } else if (value.equals("Separator")) {
View Full Code Here

        s.clear();
        s.add("small");
        s.add("medium");
        for (int i = 0; i < xsoc2.getCount(); i++) {
            XmlSchemaEnumerationFacet xsef =
                (XmlSchemaEnumerationFacet)xsoc2.getItem(i);
            String value = (String)xsef.getValue();
            if (!(value.equals("small") || value.equals("medium"))) {
                fail("Unexpected enumeration value of \"" + value
                     + "\" found.");
            }
            assertTrue(s.remove(value));
View Full Code Here

        if (el.getAttribute("fixed").equals("true")) {
            fixed = true;
        }
        XmlSchemaFacet facet;
        if (name.equals("enumeration")) {
            facet = new XmlSchemaEnumerationFacet();
        } else if (name.equals("fractionDigits")) {
            facet = new XmlSchemaFractionDigitsFacet();
        } else if (name.equals("length")) {
            facet = new XmlSchemaLengthFacet();
        } else if (name.equals("maxExclusive")) {
View Full Code Here

        Set<String> s = new HashSet<String>();
        s.add("Field");
        s.add("Separator");
        for (Iterator<XmlSchemaFacet> i = collection.iterator(); i.hasNext();) {
            XmlSchemaEnumerationFacet xsef = (XmlSchemaEnumerationFacet)i.next();
            String value = (String)xsef.getValue();
            assertTrue("Atempted to remove an enumeration with the value of " + "\"" + value
                       + "\", but the value was not in the set.", s.remove(value));
        }
        assertTrue("The set should have been empty, but instead contained: " + s + ".", s.isEmpty());
View Full Code Here

        XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction)type.getContent();
        List<XmlSchemaFacet> facets = restriction.getFacets();

        assertEquals(2, facets.size());

        XmlSchemaEnumerationFacet facet1 = (XmlSchemaEnumerationFacet)facets.get(0);
        XmlSchemaEnumerationFacet facet2 = (XmlSchemaEnumerationFacet)facets.get(1);

        final Map<?, ?> externalAttributes1 = (Map<?, ?>)facet1.getMetaInfoMap()
            .get(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES);
        final Map<?, ?> externalAttributes2 = (Map<?, ?>)facet2.getMetaInfoMap()
            .get(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES);

        assertNotNull(externalAttributes1);
        assertNotNull(externalAttributes2);
View Full Code Here

        s.clear();
        s.add("small");
        s.add("medium");
        for (int i = 0; i < xsoc2.size(); i++) {
            XmlSchemaEnumerationFacet xsef = (XmlSchemaEnumerationFacet)xsoc2.get(i);
            String value = (String)xsef.getValue();
            if (!("small".equals(value) || "medium".equals(value))) {
                fail("Unexpected enumeration value of \"" + value + "\" found.");
            }
            assertTrue(s.remove(value));
        }
View Full Code Here

        assertEquals(2, xsoc.size());
        Set<String> s = new HashSet<String>();
        s.add("tns:teamLogo");
        s.add("tns:teamMascot");
        for (int i = 0; i < xsoc.size(); i++) {
            XmlSchemaEnumerationFacet xsef = (XmlSchemaEnumerationFacet)xsoc.get(i);
            String value = (String)xsef.getValue();
            if (!("tns:teamLogo".equals(value) || "tns:teamMascot".equals(value))) {
                fail("An unexpected value of \"" + value + "\" was found.");
            }
            assertTrue(s.remove(value));
        }
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.schema.XmlSchemaEnumerationFacet

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.