Examples of XmlSchemaObjectCollection


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

     * @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());
        }
        return values;
    }
View Full Code Here

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

     * @param schema
     * @param namespaceUri
     * @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

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

            || XmlSchemaConstants.XSD_NAMESPACE_URI.equals(namespaceUri)
            || schema.getTargetNamespace().equals(namespaceUri)) {
            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;
                }
            }
        }
        XmlSchemaImport imp = new XmlSchemaImport();
        imp.setNamespace(namespaceUri);
        inc.add(imp);
        schema.getItems().add(imp);
    }
View Full Code Here

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

        if (baseTypeName != null) {
            XmlSchemaComplexType baseType = (XmlSchemaComplexType)collection.getTypeByQName(baseTypeName);
            // recurse onto the base type ...
            results.addAll(getContentAttributes(baseType, collection));
            // and now process our sequence.
            XmlSchemaObjectCollection extAttrs = getContentAttributes(type);
            for (int i = 0; i < extAttrs.getCount(); i++) {
                results.add((XmlSchemaAnnotated)extAttrs.getItem(i));
            }
            return results;
        } else {
            // no base type, the simple case.
            XmlSchemaObjectCollection attrs = type.getAttributes();
            for (int i = 0; i < attrs.getCount(); i++) {
                results.add((XmlSchemaAnnotated)attrs.getItem(i));
            }
            return results;
        }
    }
View Full Code Here

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

        code.append("}\n\n");
        code.append(nameManager.getJavascriptName(name) + ".prototype.serialize = " + functionName + ";\n\n");
    }

    private void complexTypeSerializeAttributes(XmlSchemaComplexType type, String string) {
        XmlSchemaObjectCollection attributes = type.getAttributes();
        for (int ax = 0; ax < attributes.getCount(); ax++) {
            @SuppressWarnings("unused") // work in progress.
            XmlSchemaAttribute attribute = (XmlSchemaAttribute)attributes.getItem(ax);
        }
    }
View Full Code Here

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

    }
   
    private XmlSchemaParticle getBuriedElement(XmlSchemaComplexType type,
                                              QName parentName) {
        XmlSchemaSequence sequence = getTypeSequence(type, parentName);
        XmlSchemaObjectCollection insides = sequence.getItems();
        if (insides.getCount() == 1) {
            XmlSchemaObject item = insides.getItem(0);
            if (item instanceof XmlSchemaElement || item instanceof XmlSchemaAny) {
                return (XmlSchemaParticle) item;
            }
        }
        return null;
View Full Code Here

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

    private static boolean isWrappableSequence(XmlSchemaComplexType type, String namespaceURI,
                                               MessageInfo wrapper, boolean allowRefs) {
        if (type.getParticle() instanceof XmlSchemaSequence) {
            XmlSchemaSequence seq = (XmlSchemaSequence)type.getParticle();
            XmlSchemaObjectCollection items = seq.getItems();
            boolean ret = true;
            for (int x = 0; x < items.getCount(); x++) {
                XmlSchemaObject o = items.getItem(x);
                if (!(o instanceof XmlSchemaElement)) {
                    return false;
                }
                XmlSchemaElement el = (XmlSchemaElement)o;
View Full Code Here

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

   * @return
   */
  public static boolean isArrayWrapper(XmlSchemaComplexType complexType) {
    if(complexType==null) return false;
    if(complexType.getAttributes().getCount()>0) return false;
    XmlSchemaObjectCollection items = null;
   
    XmlSchemaContentModel contentModel = complexType.getContentModel();
   
    if(contentModel!=null)
      return false;

    XmlSchemaParticle particle = complexType.getParticle();
   
    if(particle==null) {
      return false;
     
    } else if(particle instanceof XmlSchemaSequence) {
      XmlSchemaSequence sequence = (XmlSchemaSequence)particle;
      items = sequence.getItems();
     
    } else if(particle instanceof XmlSchemaChoice) {
      XmlSchemaChoice choice = (XmlSchemaChoice)particle;
      if(choice.getMaxOccurs()>1) return true;
     
    } else if(particle instanceof XmlSchemaAll) {
      XmlSchemaAll all = (XmlSchemaAll)particle;
      items = all.getItems();
     
    } else {
      return false;
    }
   
    // sequence & all
    if(items==null) return false;
    if(items.getCount()!=1) return false;
    XmlSchemaElement element = (XmlSchemaElement)items.getItem(0);
    if(element.getMaxOccurs()<2) return false;
    return true;
  }
View Full Code Here

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

  /**
   *
   * @param schema
   */
  protected void processImports(XmlSchema schema) {
    XmlSchemaObjectCollection imports = schema.getIncludes();
    for(Iterator it=imports.getIterator();it.hasNext();) {
      XmlSchemaExternal schemaImport = (XmlSchemaExternal)it.next();
      String location = schemaImport.getSchemaLocation();
      if(location!=null && location.length()>0 && schemaNameList.indexOf(location)==-1) {
        // on se base sur la location du shema
        schemaNameList.add(schemaImport.getSchemaLocation());
View Full Code Here

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

        restriction.setBaseTypeName(XmlSchemaConstants.STRING_QNAME);
        simple.setContent(restriction);

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

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