Package org.apache.ws.commons.schema

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


  protected void processGroupSequence(XmlSchemaGroupBase sequence) {
    if(log.isDebugEnabled())
      log.debug("  processSequence "+ClassUtils.simpleClassName(sequence.getClass()));

    for(Iterator it=sequence.getItems().getIterator();it.hasNext();) {
      XmlSchemaObject obj = (XmlSchemaObject)it.next();
      if(obj instanceof XmlSchemaElement) {
        processElement((XmlSchemaElement)obj);
       
      } else if(obj instanceof XmlSchemaGroupBase) {
        processGroupBase((XmlSchemaGroupBase)obj);
     
      } else {
        throw new RuntimeException(ClassUtils.simpleClassName(obj.getClass())+" not supported");
      }
    }
  }
View Full Code Here


    }

    // si le type utilis� est un wrapper de tableau
    if(eEvent.isArrayWrapper()) {
      usedWrapperArraysList.add(eEvent.getSchemaType().getQName().toString());
      XmlSchemaObject targetObj = XmlSchemaUtils.getWrappedObject((XmlSchemaComplexType)eEvent.getSchemaType());
     
      if(targetObj instanceof XmlSchemaElement) {
        eEvent.setWrappedEvent(createNewElementEvent((XmlSchemaElement)targetObj));
       
      } else if(targetObj instanceof XmlSchemaChoice) {
        log.debug("Found wrapper of choice");
        ChoiceEvent cEvent = createNewChoiceEvent((XmlSchemaChoice)targetObj);
        cEvent.setWrapped(true);
        cEvent.setNs(eEvent.getNs());
        cEvent.setName(eEvent.getName());
        cEvent.setNillable(eEvent.isNillable());
        handler.foundElementsInChoice(cEvent);
        return;
       
      } else {
        throw new RuntimeException(ClassUtils.simpleClassName(targetObj.getClass())+" not supported");
      }
    }
   
    handler.foundElementInSequence(eEvent);
  }
View Full Code Here

  private ChoiceEvent createNewChoiceEvent(XmlSchemaChoice choice) {
    List elementEvents = new ArrayList();
    List schemaTypes = new ArrayList();
   
    for(Iterator it=choice.getItems().getIterator();it.hasNext();) {
      XmlSchemaObject obj = (XmlSchemaObject)it.next();
      if(obj instanceof XmlSchemaElement) {
        XmlSchemaElement el = (XmlSchemaElement)obj;
        ElementEvent eEvent = createNewElementEvent(el);
       
        if(el.getSchemaTypeName()==null && el.getRefName()==null && eEvent.isComplexType()) {
          // if the complexType is declared inside element, we process it later
          complexTypeList.add(eEvent.getSchemaType());
        }
       
        schemaTypes.add(eEvent.getSchemaType());
        elementEvents.add(eEvent);
       
      } else {
        throw new RuntimeException(ClassUtils.simpleClassName(obj.getClass())+" not supported in choice");
      }
    }
   
    JavaQName javaType = XmlSchemaUtils.getCommonJavaType(schemaTypes);
    String className = javaType.getClassName();
View Full Code Here

    private boolean isExistImport(XmlSchema schema, String ns) {
        boolean isExist = false;

        for (Iterator ite = schema.getItems().getIterator(); ite.hasNext();) {
            XmlSchemaObject obj = (XmlSchemaObject)ite.next();
            if (obj instanceof XmlSchemaImport) {
                XmlSchemaImport xsImport = (XmlSchemaImport)obj;
                if (xsImport.getNamespace().equals(ns)) {
                    isExist = true;
                    break;
View Full Code Here

    }

    private XmlSchemaElement getExistingSchemaElement(XmlSchema schema, QName qn) {
        for (Iterator ite = schema.getItems().getIterator(); ite.hasNext();) {
            XmlSchemaObject obj = (XmlSchemaObject)ite.next();
            if (obj instanceof XmlSchemaElement) {
                XmlSchemaElement xsEle = (XmlSchemaElement)obj;
                if (xsEle.getQName().equals(qn)) {
                    return xsEle;
                }
View Full Code Here

    private void addOneSchemaCrossImports(XmlSchema schema) {
        /*
         * We need to visit all the top-level items.
         */
        for (int x = 0; x < schema.getItems().getCount(); x++) {
            XmlSchemaObject item = schema.getItems().getItem(x);
            if (item instanceof XmlSchemaElement) {
                addElementCrossImportsElement(schema, item);
            } else if (item instanceof XmlSchemaAttribute) {
                XmlSchemaAttribute attr = (XmlSchemaAttribute)item;
                XmlSchemaUtils.addImportIfNeeded(schema, attr.getRefName());
View Full Code Here

    }

    private void addCrossImportsSequence(XmlSchema schema, XmlSchemaSequence sequence) {
        XmlSchemaObjectCollection items = sequence.getItems();
        for (int x = 0; x < items.getCount(); x++) {
            XmlSchemaObject seqItem = items.getItem(x);
            if (seqItem instanceof XmlSchemaElement) {
                addElementCrossImportsElement(schema, seqItem);
            }
        }
    }
View Full Code Here

     * @return
     */
    public static boolean schemaImportsNamespace(XmlSchema schema, String namespaceUri) {
        XmlSchemaObjectCollection inc = schema.getIncludes();
        for (int x = 0; x < inc.getCount(); x++) {
            XmlSchemaObject what = inc.getItem(x);
            if (what instanceof XmlSchemaImport) {
                XmlSchemaImport imp = (XmlSchemaImport)what;
                // already there.
                if (namespaceUri.equals(imp.getNamespace())) {
                    return true;
View Full Code Here

            return;
        }
           
        XmlSchemaObjectCollection inc = schema.getIncludes();
        for (int x = 0; x < inc.getCount(); x++) {
            XmlSchemaObject what = inc.getItem(x);
            if (what instanceof XmlSchemaImport) {
                XmlSchemaImport imp = (XmlSchemaImport)what;
                // already there.
                if (namespaceUri.equals(imp.getNamespace())) {
                    return;
View Full Code Here

        XmlSchemaObjectTable schemaTypes = schema.getSchemaTypes();
        Iterator namesIterator = schemaTypes.getNames();
        while (namesIterator.hasNext()) {
            QName name = (QName)namesIterator.next();
            XmlSchemaObject xmlSchemaObject = (XmlSchemaObject)schemaTypes.getItem(name);
            if (xmlSchemaObject instanceof XmlSchemaComplexType) {
                try {
                    XmlSchemaComplexType complexType = (XmlSchemaComplexType)xmlSchemaObject;
                    if (!JavascriptUtils.notVeryComplexType(complexType)
                        && complexType.getName() != null) {
                        complexTypeConstructorAndAccessors(complexType.getQName(), complexType);
                        complexTypeSerializerFunction(complexType.getQName(), complexType);
                        domDeserializerFunction(complexType.getQName(), complexType);
                    }
                } catch (UnsupportedConstruct usc) {
                    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");
                    }
                }
            }
        }

        // now add in global elements with anonymous types.
        schemaTypes = schema.getElements();
        namesIterator = schemaTypes.getNames();
        while (namesIterator.hasNext()) {
            QName name = (QName)namesIterator.next();
            XmlSchemaObject xmlSchemaObject = (XmlSchemaObject)schemaTypes.getItem(name);
            if (xmlSchemaObject instanceof XmlSchemaElement) { // the
                // alternative
                // is too wierd
                // to
                // contemplate.
View Full Code Here

TOP

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

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.