Package org.apache.ws.commons.schema

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


                   
                    Object type = baseSchemaTypeMap.get(attrTypeName);
                    if (type == null) {
                      XmlSchemaSimpleType simpleType = attribute.getSchemaType();
                            if(simpleType != null && simpleType.getContent() instanceof XmlSchemaSimpleTypeRestriction) {
                                XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) simpleType.getContent();
                                QName baseTypeName = restriction.getBaseTypeName();
                                type = baseSchemaTypeMap.get(baseTypeName);
                                attrQname = att.getRefName();
                            }
                            //TODO: Handle XmlSchemaSimpleTypeUnion and XmlSchemaSimpleTypeList
                        }
View Full Code Here


        // handle the restriction
        XmlSchemaSimpleTypeContent content = simpleType.getContent();
        if (content != null) {
            if (content instanceof XmlSchemaSimpleTypeRestriction) {
                XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) content;
               
                QName baseTypeName = restriction.getBaseTypeName();
                //check whether the base type is one of the base schema types
                if (baseSchemaTypeMap.containsKey(baseTypeName)) {
                    //process restriction base type
                    QName qName = simpleType.getQName();
                    if(qName == null) {
                        qName = (QName) simpleType.getMetaInfoMap().get(SchemaConstants.SchemaCompilerInfoHolder.FAKE_QNAME);
                    }
                    processSimpleRestrictionBaseType(qName, restriction.getBaseTypeName(),metaInfHolder);
         
                    //process facets
                    XmlSchemaObjectCollection facets = restriction.getFacets();
                    processFacets(facets,metaInfHolder);
                } else {
                    //recurse
                    if (restriction.getBaseType() != null) {
                        processSimpleSchemaType(restriction.getBaseType(), null, parentSchema);
                    }
                }
            }else if (content instanceof XmlSchemaSimpleTypeUnion) {
                //Todo - Handle unions here
                throw new SchemaCompilationException(
View Full Code Here

    public static boolean isEumeration(XmlSchemaSimpleType type) {
        XmlSchemaSimpleTypeContent content = type.getContent();
        if (!(content instanceof XmlSchemaSimpleTypeRestriction)) {
            return false;
        }
        XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) content;
        XmlSchemaObjectCollection facets = restriction.getFacets();
        for (int x = 0; x < facets.getCount(); x++) {
            XmlSchemaFacet facet = (XmlSchemaFacet) facets.getItem(x);
            if (!(facet instanceof XmlSchemaEnumerationFacet)) {
                return false;
            }
View Full Code Here

     * @param type
     * @return
     */
    public static List<String> enumeratorValues(XmlSchemaSimpleType type) {
        XmlSchemaSimpleTypeContent content = type.getContent();
        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());
View Full Code Here

                typeInfo.simpleBaseType = list.getItemType().getQName();

                // this is a list
                typeInfo.listType = true;
            } else if(content instanceof XmlSchemaSimpleTypeRestriction) {
                XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) content;
                typeInfo.simpleBaseType = restriction.getBaseTypeName();

                // is this an enumeration?
                for (Iterator iterator = restriction.getFacets().getIterator(); iterator.hasNext();) {
                    if (iterator.next() instanceof XmlSchemaEnumerationFacet) {
                        typeInfo.enumType = true;
                        break;
                    }
View Full Code Here

                typeInfo.simpleBaseType = list.getItemType().getQName();

                // this is a list
                typeInfo.listType = true;
            } else if (content instanceof XmlSchemaSimpleTypeRestriction) {
                XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) content;
                typeInfo.simpleBaseType = restriction.getBaseTypeName();

                // is this an enumeration?
                for (Iterator iterator = restriction.getFacets().getIterator(); iterator.hasNext(); ) {
                    if (iterator.next() instanceof XmlSchemaEnumerationFacet) {
                        typeInfo.enumType = true;
                        break;
                    }
View Full Code Here

    @Override
    public void writeSchema(XmlSchema root) {
        if (serializedWhenUnknown) {
            XmlSchemaSimpleType simple = new XmlSchemaSimpleType(root, true);
            simple.setName("serializedJavaObject");
            XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
            simple.setContent(restriction);
            restriction.setBaseTypeName(XmlSchemaConstants.BASE64BINARY_QNAME);
        }
    }
View Full Code Here

        }
        public void writeSchema(XmlSchema root) {
            XmlSchemaSimpleType xst = new XmlSchemaSimpleType(root, true);
            xst.setName("class");
           
            XmlSchemaSimpleTypeRestriction content = new XmlSchemaSimpleTypeRestriction();
            content.setBaseTypeName(XMLSchemaQNames.XSD_STRING);
            xst.setContent(content);
        }
View Full Code Here

    @Override
    public void writeSchema(XmlSchema root) {

        XmlSchemaSimpleType simple = new XmlSchemaSimpleType(root, true);
        simple.setName(getSchemaType().getLocalPart());
        XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
        restriction.setBaseTypeName(XmlSchemaConstants.STRING_QNAME);
        simple.setContent(restriction);

        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

    @Override
    public void writeSchema(XmlSchema root) {
        if (serializedWhenUnknown) {
            XmlSchemaSimpleType simple = new XmlSchemaSimpleType(root, true);
            simple.setName("serializedJavaObject");
            XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
            simple.setContent(restriction);
            restriction.setBaseTypeName(XmlSchemaConstants.BASE64BINARY_QNAME);
        }
    }
View Full Code Here

TOP

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

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.