Package org.apache.ws.commons.schema

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


        Object[] constants = getTypeClass().getEnumConstants();

        List<XmlSchemaFacet> facets = restriction.getFacets();
        for (Object constant : constants) {
            XmlSchemaEnumerationFacet f = new XmlSchemaEnumerationFacet();
            f.setValue(((Enum)constant).name());
            facets.add(f);
        }
    }
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

        // Create enumeration facets for each value
        for (int i = 0; i < enums.length; i++) {

            String enumeration = enums[i].trim();
            XmlSchemaEnumerationFacet enumerationFacet = new XmlSchemaEnumerationFacet();
            enumerationFacet.setValue(enumeration);
            simpleTypeRestriction.getFacets().add(enumerationFacet);
        }

        return simpleType;
    }
View Full Code Here

                        Iterator iterator1 = facets.getIterator();
                        // Used to check whether the incoming value of the enumeration matches one thats defined in the
                        // schema.
                        boolean valueFound = false;
                        while (iterator1.hasNext()) {
                            XmlSchemaEnumerationFacet enumerationFacet =
                                    (XmlSchemaEnumerationFacet) iterator1.next();
                            if (enumerationFacet.getValue().equals(object)) {
                                valueFound = true;
                                break;
                            }
                        }
                        if (!valueFound) {
View Full Code Here

                XmlSchemaObjectCollection facets = restriction.getFacets();
                EnumType enumType = (EnumType) dataType;
                List enumMembers = enumType.getEnumMembers();
                for (int i = 0; i < enumMembers.size(); i++) {
                    facets.add(new XmlSchemaEnumerationFacet(enumMembers.get(i), false));
                }

                XmlSchemaElement eltOuter = new XmlSchemaElement();
                eltOuter.setName(simpleName);
                eltOuter.setQName(schemaTypeName);
View Full Code Here

        corbaEnum.setRepositoryID(repoString + name.getLocalPart().replace('.', '/') + idlversion);
        Iterator enums = restrictionType.getFacets().getIterator();

        while (enums.hasNext()) {
            XmlSchemaEnumerationFacet val = (XmlSchemaEnumerationFacet)enums.next();
            Enumerator enumerator = new Enumerator();
            enumerator.setValue(val.getValue().toString());
            corbaEnum.getEnumerator().add(enumerator);
        }
        return corbaEnum;
    }
View Full Code Here

                }
                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

        corbaEnum.setQName(name);

        corbaEnum.setRepositoryID(REPO_STRING + name.getLocalPart().replace('.', '/') + IDL_VERSION);

        for (XmlSchemaFacet f : restrictionType.getFacets()) {
            XmlSchemaEnumerationFacet val = (XmlSchemaEnumerationFacet)f;
            Enumerator enumerator = new Enumerator();
            enumerator.setValue(val.getValue().toString());
            corbaEnum.getEnumerator().add(enumerator);
        }
        return corbaEnum;
    }
View Full Code Here

        XmlSchemaSimpleTypeContent content = type.getContent();
        XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) content;
        List<XmlSchemaFacet> facets = restriction.getFacets();
        List<String> values = new ArrayList<String>();
        for (XmlSchemaFacet facet : facets) {
            XmlSchemaEnumerationFacet enumFacet = (XmlSchemaEnumerationFacet) facet;
            values.add(enumFacet.getValue().toString());
        }
        return values;
    }
View Full Code Here

        XmlSchemaPatternFacet pattern = (XmlSchemaPatternFacet) obj;
        metaInfHolder.setPatternFacet(pattern.getValue().toString());
      }

      else if ( obj instanceof XmlSchemaEnumerationFacet ) {
        XmlSchemaEnumerationFacet enumeration = (XmlSchemaEnumerationFacet) obj;
        metaInfHolder.addEnumFacet(enumeration.getValue().toString());
      }

      else if ( obj instanceof XmlSchemaLengthFacet ) {
        XmlSchemaLengthFacet length = (XmlSchemaLengthFacet) obj;
        metaInfHolder.setLengthFacet(Integer.parseInt(length.getValue().toString()));
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.