Examples of XmlSchemaSimpleType


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

                    LOG.warning(usc.toString());
                    continue; // it could be empty, but the style checker
                    // would complain.
                }
            } else if (xmlSchemaObject instanceof XmlSchemaSimpleType) {
                XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)xmlSchemaObject;
                if (XmlSchemaUtils.isEumeration(simpleType)) {
                    List<String> values = XmlSchemaUtils.enumeratorValues(simpleType);
                    code.append("//\n");
                    code.append("// Simple type (enumeration) " + simpleType.getQName() + "\n");
                    code.append("//\n");
                    for (String value : values) {
                        code.append("// - " + value + "\n");
                    }
                }
View Full Code Here

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

        }
    }
   
    private void visitAnonBoundedString() {
        // xmlschema:bounded anon string
        XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema);
        simpleType.setName(stringScopedName.toString());
        XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
        restriction.setBaseTypeName(Constants.XSD_STRING);
        XmlSchemaMaxLengthFacet maxLengthFacet = new XmlSchemaMaxLengthFacet();
        maxLengthFacet.setValue(boundNode.toString());
        restriction.getFacets().add(maxLengthFacet);
        simpleType.setContent(restriction);

        // add schemaType
        schema.getItems().add(simpleType);
        schema.addType(simpleType);
        setSchemaType(simpleType);

        CorbaTypeImpl anon = null;
        if (stringNode.getType() == IDLTokenTypes.LITERAL_string) {
            // corba:anonstring
            Anonstring anonstring = new Anonstring();
            anonstring.setQName(new QName(typeMap.getTargetNamespace(), stringScopedName.toString()));
            anonstring.setBound(new Long(boundNode.toString()));
            anonstring.setType(simpleType.getQName());

            anon = anonstring;
           
        } else if (stringNode.getType() == IDLTokenTypes.LITERAL_wstring) {
            // corba:anonwstring
            Anonwstring anonwstring = new Anonwstring();
            anonwstring.setQName(new QName(typeMap.getTargetNamespace(), stringScopedName.toString()));
            anonwstring.setBound(new Long(boundNode.toString()));
            anonwstring.setType(simpleType.getQName());
           
            anon = anonwstring;
           
        } else {
            // should never get here
View Full Code Here

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

        setCorbaType(anon);
    }
   
    private void visitBoundedString() {
        // xmlschema:bounded string
        XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema);
        simpleType.setName(stringScopedName.toString());
        XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
        restriction.setBaseTypeName(Constants.XSD_STRING);
        XmlSchemaMaxLengthFacet maxLengthFacet = new XmlSchemaMaxLengthFacet();
        maxLengthFacet.setValue(boundNode.toString());
        restriction.getFacets().add(maxLengthFacet);
        simpleType.setContent(restriction);

        setSchemaType(simpleType);
                      
        Scope anonstringScopedName = new Scope(getScope(), "_Anon1_" + stringScopedName.tail());
        String anonstringName = anonstringScopedName.toString();
        CorbaTypeImpl anon = null;
        if (stringNode.getType() == IDLTokenTypes.LITERAL_string) {
            // corba:anonstring
            Anonstring anonstring = new Anonstring();
            anonstring.setQName(new QName(typeMap.getTargetNamespace(), anonstringName));
            anonstring.setBound(new Long(boundNode.toString()));
            anonstring.setType(simpleType.getQName());

            anon = anonstring;
           
        } else if (stringNode.getType() == IDLTokenTypes.LITERAL_wstring) {
            // corba:anonwstring
            Anonwstring anonwstring = new Anonwstring();
            anonwstring.setQName(new QName(typeMap.getTargetNamespace(), anonstringName));
            anonwstring.setBound(new Long(boundNode.toString()));
            anonwstring.setType(simpleType.getQName());
           
            anon = anonwstring;
           
        } else {
            // should never get here
            throw new RuntimeException("StringVisitor attempted to visit an invalid node");
        }
       
        // add corba:anonstring
        typeMap.getStructOrExceptionOrUnion().add(anon);

        // corba:alias
        Alias alias = new Alias();
        alias.setQName(new QName(typeMap.getTargetNamespace(), stringScopedName.toString()));
        alias.setBasetype(anon.getQName());
        alias.setType(simpleType.getQName());
        alias.setRepositoryID(stringScopedName.toIDLRepositoryID());

        // add corba:alias
        setCorbaType(alias);
    }
View Full Code Here

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

        } else  {
            QName typeName = getTypeName(beanInfo);
            if (typeName != null) {
                XmlSchemaType type = schemas.getTypeByQName(typeName);
                if  (isList && type instanceof XmlSchemaSimpleType) {
                    XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(type.getParent(), false);
                    XmlSchemaSimpleTypeList list = new XmlSchemaSimpleTypeList();
                    XmlSchemaSimpleType stype = (XmlSchemaSimpleType)type;
                    list.setItemTypeName(stype.getQName());
                    simpleType.setContent(list);
                    part.setXmlSchema(simpleType);
                    if (part.getConcreteName() == null) {
                        part.setConcreteName(new QName(null, part.getName().getLocalPart()));
                    }
View Full Code Here

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

                    LOG.warning(usc.toString());
                    continue; // it could be empty, but the style checker
                    // would complain.
                }
            } else if (xmlSchemaObject instanceof XmlSchemaSimpleType) {
                XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)xmlSchemaObject;
                if (XmlSchemaUtils.isEumeration(simpleType)) {
                    List<String> values = XmlSchemaUtils.enumeratorValues(simpleType);
                    code.append("//\n");
                    code.append("// Simple type (enumeration) " + simpleType.getQName() + "\n");
                    code.append("//\n");
                    for (String value : values) {
                        code.append("// - " + value + "\n");
                    }
                }
View Full Code Here

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

                                                             " from the parent schema " +
                                                             parentSchema.getTargetNamespace());
                    } else {
                        XmlSchemaType type = resolvedSchema.getTypeByName(schemaTypeName);
                        if (type instanceof XmlSchemaSimpleType) {
                            XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType) type;

                            if (simpleType != null) {
                                if (!isAlreadyProcessed(schemaTypeName)) {
                                    //process simple type
                                    processSimpleSchemaType(simpleType, null, resolvedSchema, null);
                                }
                                metainf.registerMapping(att.getQName(),
                                                        schemaTypeName,
                                                        processedTypemap.get(schemaTypeName).toString(),
                                                        SchemaConstants.ATTRIBUTE_TYPE);
                                // add optional attribute status if set
                                String use = att.getUse().toString();
                                if (USE_NONE.equals(use) || USE_OPTIONAL.equals(use)) {
                                    metainf.addtStatus(att.getQName(), SchemaConstants.OPTIONAL_TYPE);
                                }
                            }

                        }
                    }
                }
            } else {
                // this attribute has a type but does not have a name, seems to be invalid
            }

        } else if (att.getRef().getTargetQName() != null) {

            XmlSchema resolvedSchema = getParentSchema(parentSchema, att.getRef().getTargetQName(),
                                                       COMPONENT_ATTRIBUTE);
            if (resolvedSchema == null) {
                throw new SchemaCompilationException("can not find the attribute " +
                                                     att.getRef().getTargetQName() +
                                                     " from the parent schema " +
                                                     parentSchema.getTargetNamespace());
            } else {
                XmlSchemaAttribute xmlSchemaAttribute =
                        resolvedSchema.getAttributes().get(att.getRef().getTargetQName());
                if (xmlSchemaAttribute != null) {
                    // call recursively to process the schema
                    processAttribute(xmlSchemaAttribute, metainf, resolvedSchema);
                } else {
                    throw new SchemaCompilationException("Attribute QName reference refer to an invalid attribute " +
                                                         att.getRef().getTargetQName());
                }
            }

        } else {
            // this attribute refers to a custom type, probably one of the extended simple types.
            // with the inline schema definition
            QName attributeQName = att.getQName();
            if (attributeQName != null) {
                XmlSchemaSimpleType attributeSimpleType = att.getSchemaType();
                XmlSchema resolvedSchema = parentSchema;
                if (attributeSimpleType == null) {
                    // try to get the schema for using qname
                    QName attributeSchemaQname = att.getSchemaTypeName();
                    if (attributeSchemaQname != null) {
                        resolvedSchema = getParentSchema(parentSchema, attributeSchemaQname,
                                                         COMPONENT_TYPE);
                        if (resolvedSchema == null) {
                            throw new SchemaCompilationException("can not find the type " +
                                                                 attributeSchemaQname
                                                                 + " from the parent schema " +
                                                                 parentSchema.getTargetNamespace());
                        } else {
                            attributeSimpleType = (XmlSchemaSimpleType)
                                    resolvedSchema.getTypeByName(attributeSchemaQname);
                        }
                    }
                }

                if (attributeSimpleType != null) {
                    QName schemaTypeQName = att.getSchemaTypeName();
                    if (schemaTypeQName == null) {
                        // set the parent schema target name space since attribute Qname uri is ""
                        if (attributeSimpleType.getQName() != null) {
                            schemaTypeQName = attributeSimpleType.getQName();
                        } else {
                            schemaTypeQName = new QName(parentSchema.getTargetNamespace(),
                                                        attributeQName.getLocalPart() +
                                                        getNextTypeSuffix(attributeQName.getLocalPart()));
View Full Code Here

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

                                                                     " from the parent schema " +
                                                                     parentSchema.getTargetNamespace());
                            } else {
                                XmlSchemaType type = resolvedSchema.getTypeByName(qname);
                                if (type instanceof XmlSchemaSimpleType) {
                                    XmlSchemaSimpleType memberSimpleType = (XmlSchemaSimpleType) type;
                                    if (!isAlreadyProcessed(qname)) {
                                        processSimpleSchemaType(memberSimpleType, null,
                                                                resolvedSchema, null);
                                    }
                                    metaInfHolder.addMemberType(qname, processedTypemap.get(qname));
                                } else {
                                    throw new SchemaCompilationException("Unions can not have complex types as a member type");
                                }
                            }
                        }
                    }
                } else {
                    QName childQname;
                    int i = 1;
                    for (XmlSchemaSimpleType xmlSchemaObject : simpleTypeUnion.getBaseTypes()) {
                        i++;
                        XmlSchemaSimpleType unionSimpleType = xmlSchemaObject;
                        childQname = unionSimpleType.getQName();
                        if (childQname == null) {
                            // we create a fake Qname for all these simple types since most propably they don't have one
                            childQname = new QName(parentSimpleTypeQname.getNamespaceURI(),
                                                   parentSimpleTypeQname.getLocalPart() +
                                                   getNextTypeSuffix(parentSimpleTypeQname.
                                                           getLocalPart()));
                        }
                        // this is an inner simple type of the union so it shold not have
                        // processed
                        processSimpleSchemaType(unionSimpleType, null, parentSchema, childQname);
                        metaInfHolder.addMemberType(childQname, processedTypemap.get(childQname));


                    }
                }

                metaInfHolder.setUnion(true);

            } else if (content instanceof XmlSchemaSimpleTypeList) {
                XmlSchemaSimpleTypeList simpleTypeList = (XmlSchemaSimpleTypeList) content;
                QName itemTypeQName = simpleTypeList.getItemTypeName();

                if (itemTypeQName != null) {
                    if (!isAlreadyProcessed(itemTypeQName)) {
                        XmlSchema resolvedSchema = getParentSchema(parentSchema, itemTypeQName,
                                                                   COMPONENT_TYPE);
                        if (resolvedSchema == null) {
                            throw new SchemaCompilationException("can not find the type " +
                                                                 itemTypeQName +
                                                                 " from the parent type " +
                                                                 parentSchema.getTargetNamespace());
                        } else {
                            XmlSchemaType simpleSchemaType = resolvedSchema.
                                    getTypeByName(itemTypeQName);
                            if (simpleSchemaType instanceof XmlSchemaSimpleType) {
                                processSimpleSchemaType((XmlSchemaSimpleType) simpleSchemaType,
                                                        null, resolvedSchema, null);
                            }
                        }
                    }
                } else {
                    XmlSchemaSimpleType listSimpleType = simpleTypeList.getItemType();
                    itemTypeQName = listSimpleType.getQName();
                    if (itemTypeQName == null) {
                        // we create a fake Qname for all these simple types since most propably they don't have one
                        itemTypeQName = new QName(parentSimpleTypeQname.getNamespaceURI(),
                                                  parentSimpleTypeQname.getLocalPart() + "_type0");
                    }
View Full Code Here

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

                QName partQName = WSDLUtil.getPartQName(opName,
                        qnameSuffix,
                        message.getElementQName().getLocalPart());
                mapper.addTypeMappingName(partQName, (String)basicTypeMap.getTypeMap().get(schemaTypeQname));
            } else if (schemaType instanceof XmlSchemaSimpleType) {
                XmlSchemaSimpleType xmlSchemaSimpleType = (XmlSchemaSimpleType) schemaType;
                populateClassName(xmlSchemaSimpleType.getMetaInfoMap(),
                        mapper,
                        opName,
                        false,
                        message.getElementQName().getLocalPart(),
                        qnameSuffix);
View Full Code Here

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

   * @param attribute
   * @return
   */
  private AttributeEvent createNewAttributeEvent(XmlSchemaAttribute attribute) {
    QName simpleTypeQName = attribute.getSchemaTypeName();
    XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)simpleTypeMap.get(simpleTypeQName.toString());
   
    if(simpleType!=null) {
      simpleTypeQName = XmlSchemaUtils.getSimpleTypeQName(simpleType);
    }
   
View Full Code Here

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

    }

    @Override
    public void writeSchema(XmlSchema root) {
        if (serializedWhenUnknown) {
            XmlSchemaSimpleType simple = new XmlSchemaSimpleType(root);
            simple.setName("serializedJavaObject");
            root.addType(simple);
            root.getItems().add(simple);
            XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();   
            simple.setContent(restriction);
            restriction.setBaseTypeName(XmlSchemaConstants.BASE64BINARY_QNAME);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.