Package org.apache.ws.commons.schema

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


            SchemaCollection schemaCollection = serviceInfo.getXmlSchemaCollection();

            // First pass, fill in any types for which we have a name but no
            // type.
            for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
                XmlSchemaObjectTable elementsTable = schemaInfo.getSchema().getElements();
                Iterator elementsIterator = elementsTable.getNames();
                while (elementsIterator.hasNext()) {
                    QName elementName = (QName)elementsIterator.next();
                    XmlSchemaElement element = schemaInfo.getSchema().getElementByName(elementName);
                    if (element.getSchemaType() == null) {
                        QName typeName = element.getSchemaTypeName();
View Full Code Here


  /*
   * Extract the element declarations from the given schema.
   */
  private void buildElementDeclarations(XmlSchema schemaDef, String schemaTns, URI typeSystemURI) {
       
      XmlSchemaObjectTable elementTable = schemaDef.getElements();
        NamespacePrefixList prefixes = schemaDef.getNamespaceContext();
      Iterator qnames = elementTable.getNames();
      while (qnames.hasNext()) {
          QName xseQN = (QName) qnames.next();
            if(fDesc.getElementDeclaration(xseQN) != null) {
                //The Description already contains this Element Declaration.
                continue;
                //This check is necessary because the XmlSchema.equals method, which gets used
                //to evaluate fSchemas.contains(..), cannot detect the equivalence of a schema
                //that is xs:imported within <wsdl:types> and also xs:imported within by
                //an inlined schema within the same <wsdl:types> element.
                //Error case is result.xsd in the W3C WSDL 2.0 test case SparqlQuerySimplified-1G.
                //This check may be necessary anyway, because if the document assertion Schema-1073
                //is violated, we don't want the duplicate schema components in the component model.
                //TODO check that this behaviour is correct (eliminating duplicates)
            }
            QName edQN = xseQN;
            if(xseQN.getNamespaceURI() == null && schemaTns != null) {
                //this is how XmlSchema represents tns for chameleon xs:includes,
                //so replace it with the including schema's tns.
                edQN = new QName(schemaTns, xseQN.getLocalPart(), xseQN.getPrefix());
            }
            if(edQN.getPrefix() == "" || edQN.getPrefix() == null) {
                //if a prefix has been declared for this NS uri, include it in the qname
                String pfx = prefixes.getPrefix(edQN.getNamespaceURI());
                if(pfx != null) {
                    edQN = new QName(edQN.getNamespaceURI(), edQN.getLocalPart(), pfx);
                }
            }
          if(schemaTns == null || schemaTns.equals(edQN.getNamespaceURI())) //TODO test with schema imports, may be incorrect.
            {
              ElementDeclarationImpl ed = new ElementDeclarationImpl();
              ed.setName(edQN);
              ed.setSystem(typeSystemURI);
              ed.setContentModel(Constants.API_APACHE_WS_XS);
              ed.setContent(elementTable.getItem(xseQN));
              fDesc.addElementDeclaration(ed);
          }
      }
  }
View Full Code Here

  /*
   * Extract the type definitions from the given schema.
   */
  private void buildTypeDefinitions(XmlSchema schemaDef, String schemaTns, URI typeSystemURI) {
       
      XmlSchemaObjectTable typeTable = schemaDef.getSchemaTypes();
        NamespacePrefixList prefixes = schemaDef.getNamespaceContext();
      Iterator qnames = typeTable.getNames();
      while (qnames.hasNext()) {
          QName xstQN = (QName) qnames.next();
           
            if(SchemaConstants.NS_STRING_SCHEMA.equals(schemaTns) &&
               !SchemaConstants.LIST_Q_BUILT_IN_TYPES.contains(xstQN)) {
                //XML Schema namespace is implicitly imported to get built-in types...we don't want non-built-in types.
                //TODO detect if the XML Schema NS has been explicitly imported (if so, we want ALL type defs)
                continue;
            }
           
            if(fDesc.getTypeDefinition(xstQN) != null) {
                //The Description already contains this Type Definition.
                continue;
                //The same comments apply here as stated in the buildElementDeclarations method.
                //TODO check that this behaviour is correct (per assertion Schema-1073).
            }
            QName tdQN = xstQN;
            if(xstQN.getNamespaceURI() == null && schemaTns != null) {
                //this is how XmlSchema represents tns for chameleon xs:includes,
                //so replace it with the including schema's tns.
                tdQN = new QName(schemaTns, xstQN.getLocalPart(), xstQN.getPrefix());
            }
            if(tdQN.getPrefix() == emptyString || tdQN.getPrefix() == null) {
                //if a prefix has been declared for this NS uri, include it in the qname
                String pfx = prefixes.getPrefix(tdQN.getNamespaceURI());
                if(pfx != null) {
                    tdQN = new QName(tdQN.getNamespaceURI(), tdQN.getLocalPart(), pfx);
                }
            }
          if (schemaTns == null || schemaTns.equals(tdQN.getNamespaceURI()))
            {
              TypeDefinitionImpl td = new TypeDefinitionImpl();
              td.setName(tdQN);
              td.setSystem(typeSystemURI);
              td.setContentModel(Constants.API_APACHE_WS_XS);
              td.setContent(typeTable.getItem(xstQN));
              fDesc.addTypeDefinition(td);
          }
      }
  }
View Full Code Here

    String ns = iSchemaNs.toString();
   
    if(schemas.containsKey(ns))
    {
    List schemaList = (List)schemas.get(ns);
    XmlSchemaObjectTable elements = iSchema.getSchemaDefinition().getElements();
    Iterator elementNames = elements.getNames();
    while(elementNames.hasNext())
    {
      QName elementName = (QName)elementNames.next();
      Iterator otherInlineSchemas = schemaList.iterator();
      while(otherInlineSchemas.hasNext())
      {
      if(((InlinedSchema)otherInlineSchemas.next()).getSchemaDefinition().getElementByName(elementName) != null)
      {
        // Duplicate element defined.
        errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1073", new Object[]{elementName, ns}, ErrorReporter.SEVERITY_ERROR);
        isValid = false;
      }
      }
   
    }
   
    XmlSchemaObjectTable types = iSchema.getSchemaDefinition().getSchemaTypes();
    Iterator typeNames = types.getNames();
    while(typeNames.hasNext())
    {
      QName typeName = (QName)typeNames.next();
      Iterator otherInlineSchemas = schemaList.iterator();
      while(otherInlineSchemas.hasNext())
View Full Code Here

            typeMappingType.setTargetNamespace(getIdlNamespace());
            Iterator s = xmlSchemaList.iterator();
           
            while (s.hasNext()) {
                XmlSchema xmlSchemaTypes = (XmlSchema)s.next();           
                XmlSchemaObjectTable objs = xmlSchemaTypes.getSchemaTypes();
                Iterator i = objs.getValues();               
                while (i.hasNext()) {               
                    XmlSchemaType type = (XmlSchemaType)i.next();
                    boolean anonymous = wsdltypes.isAnonymous(type.getName());
                    corbaTypeImpl = convertSchemaToCorbaType(type, type.getQName(), null,
                                                             anonymous);
View Full Code Here

    }         

   
    private void addCorbaElements(CorbaTypeImpl corbaTypeImpl,
                                  XmlSchema xmlSchemaTypes) throws Exception {
        XmlSchemaObjectTable elements = xmlSchemaTypes.getElements();                           
        Iterator i2 = elements.getValues();               
        while (i2.hasNext()) {               
            XmlSchemaElement el = (XmlSchemaElement)i2.next();
            boolean anonymous = false;
            if (el.getSchemaType() == null) {
                anonymous = true;
View Full Code Here

            SchemaCollection schemaCollection = serviceInfo.getXmlSchemaCollection();

            // First pass, fill in any types for which we have a name but no
            // type.
            for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
                XmlSchemaObjectTable elementsTable = schemaInfo.getSchema().getElements();
                Iterator elementsIterator = elementsTable.getNames();
                while (elementsIterator.hasNext()) {
                    QName elementName = (QName)elementsIterator.next();
                    XmlSchemaElement element = schemaInfo.getSchema().getElementByName(elementName);
                    if (element.getSchemaType() == null) {
                        QName typeName = element.getSchemaTypeName();
View Full Code Here

        }

        //select all the elements. We generate the code for types
        //only if the elements refer them!!! regardless of the fact that
        //we have a list of elementnames, we'll need to process all the elements
        XmlSchemaObjectTable elements = schema.getElements();
        Iterator xmlSchemaElement1Iterator = elements.getValues();
        while (xmlSchemaElement1Iterator.hasNext()) {
            //this is the set of outer elements so we need to generate classes
            //The outermost elements do not contain occurence counts (!) so we do not need
            //to check for arraytypes
            processElement((XmlSchemaElement) xmlSchemaElement1Iterator.next(), schema);
        }

        Iterator xmlSchemaElement2Iterator = elements.getValues();

        // re-iterate through the elements and write them one by one
        // if the mode is unpack this process will not really write the
        // classes but will accumilate the models for a final single shot
        // write
View Full Code Here

        for (ServiceInfo serviceInfo : service.getServiceInfos()) {
            SchemaCollection schemaCollection = serviceInfo.getXmlSchemaCollection();
           
            // First pass, fill in any types for which we have a name but no type.
            for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
                XmlSchemaObjectTable elementsTable = schemaInfo.getSchema().getElements();
                Iterator elementsIterator = elementsTable.getNames();
                while (elementsIterator.hasNext()) {
                    QName elementName = (QName)elementsIterator.next();
                    XmlSchemaElement element = schemaInfo.getSchema().getElementByName(elementName);
                    if (element.getSchemaType() == null) {
                        QName typeName = element.getSchemaTypeName();
View Full Code Here

        }

        //select all the elements. We generate the code for types
        //only if the elements refer them!!! regardless of the fact that
        //we have a list of elementnames, we'll need to process all the elements
        XmlSchemaObjectTable elements = schema.getElements();
        Iterator xmlSchemaElement1Iterator = elements.getValues();
        while (xmlSchemaElement1Iterator.hasNext()) {
            //this is the set of outer elements so we need to generate classes
            //The outermost elements do not contain occurence counts (!) so we do not need
            //to check for arraytypes
            processElement((XmlSchemaElement) xmlSchemaElement1Iterator.next(), schema);
        }

        Iterator xmlSchemaElement2Iterator = elements.getValues();

        // re-iterate through the elements and write them one by one
        // if the mode is unpack this process will not really write the
        // classes but will accumilate the models for a final single shot
        // write
View Full Code Here

TOP

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

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.