Package org.apache.ws.commons.schema.utils

Examples of org.apache.ws.commons.schema.utils.NamespacePrefixList


        if (schemaObj.version != null) {
            serializedSchema.setAttribute("version", schemaObj.version);
        }

        //add the extra namespace decalarations if any are available
        NamespacePrefixList ctx = schemaObj.getNamespaceContext();
        String[] prefixes = ctx.getDeclaredPrefixes();
        for (int i = 0;  i < prefixes.length;  i++) {
            String prefix = prefixes[i];
            String uri = ctx.getNamespaceURI(prefix);
            if (!Constants.DEFAULT_NS_PREFIX.equals(prefix)) {
                serializedSchema.setAttributeNS(Constants.XMLNS_ATTRIBUTE_NS_URI,
                        Constants.XMLNS_ATTRIBUTE + ":" + prefix, uri);
            }
        }
View Full Code Here


    /**
     * Set up <schema> namespaces appropriately and append that attr
     * into specified element
     */
    private Element setupNamespaces(Document schemaDocs, XmlSchema schemaObj) {
        NamespacePrefixList ctx = schemaObj.getNamespaceContext();
        schemaObj.schema_ns_prefix = xsdPrefix = ctx.getPrefix(xsdNamespace);
        if(xsdPrefix == null) {
            schemaObj.schema_ns_prefix = xsdPrefix = "";   
        }
        String[] prefixes = ctx.getDeclaredPrefixes();
        for (int i = 0;  i < prefixes.length;  i++) {
            String prefix = prefixes[i];
            String uri = ctx.getNamespaceURI(prefix);
            schema_ns.put(uri, prefix);
        }
        //for schema that not set the xmlns attrib member
        if (schema_ns.get(xsdNamespace) == null) {
            schema_ns.put(xsdNamespace, xsdPrefix);
View Full Code Here

                if (value.indexOf(":") > -1 && !nodeName.startsWith("xmlns")) {
                    String prefix = value.substring(0, value.indexOf(":"));
                    String oldNamespace;
                    if ((oldNamespace = (String) namespaces.get(prefix)) != null) {
                        value = value.substring(value.indexOf(":") + 1);
                        NamespacePrefixList ctx = schema.getNamespaceContext();
                        String[] prefixes = ctx.getDeclaredPrefixes();
                        for (int j = 0;  j < prefixes.length;  j++) {
                            String pref = prefixes[j];
                            String uri = ctx.getNamespaceURI(pref);
                            if (uri.equals(oldNamespace)) {
                                value = prefix + ":" + value;
                            }
                        }
                    }
View Full Code Here

  }

  private XmlSchema addNameSpaces(int i) {
    XmlSchema schema = (XmlSchema) schemaList.get(i);
    NamespaceMap map = (NamespaceMap) namespaceMap.clone();
    NamespacePrefixList namespaceContext = schema.getNamespaceContext();
    String prefixes[] = namespaceContext.getDeclaredPrefixes();
    for (int j = 0; j < prefixes.length; j++) {
      String prefix = prefixes[j];
      map.add(prefix, namespaceContext.getNamespaceURI(prefix));
    }
    schema.setNamespaceContext(map);
    return schema;
  }
View Full Code Here

    public String getSchemaTargetNameSpace() {
        return schemaTargetNameSpace;
    }

    protected void addImport(XmlSchema xmlSchema, QName schemaTypeName) {
        NamespacePrefixList map = xmlSchema.getNamespaceContext();
        if (map == null ||
                ((map instanceof NamespaceMap) && ((NamespaceMap) map).values() == null) ||
                schemaTypeName == null) {
            return;
        }
View Full Code Here

            }
        }
    }

    private void addImport(XmlSchema xmlSchema, QName schemaTypeName) {
        NamespacePrefixList map = xmlSchema.getNamespaceContext();
        if (map == null ||
                ((map instanceof NamespaceMap) && ((NamespaceMap) map).values() == null) ||
                schemaTypeName == null) {
            return;
        }
View Full Code Here

  }

  private XmlSchema addNameSpaces(int i) {
    XmlSchema schema = (XmlSchema) schemaList.get(i);
    NamespaceMap map = (NamespaceMap) namespaceMap.clone();
    NamespacePrefixList namespaceContext = schema.getNamespaceContext();
    String prefixes[] = namespaceContext.getDeclaredPrefixes();
    for (int j = 0; j < prefixes.length; j++) {
      String prefix = prefixes[j];
      map.add(prefix, namespaceContext.getNamespaceURI(prefix));
    }
    schema.setNamespaceContext(map);
    return schema;
  }
View Full Code Here

    public String getSchemaTargetNameSpace() {
        return schemaTargetNameSpace;
    }

    protected void addImport(XmlSchema xmlSchema, QName schemaTypeName) {
        NamespacePrefixList map = xmlSchema.getNamespaceContext();
        if (map == null ||
                ((map instanceof NamespaceMap) && ((NamespaceMap) map).values() == null) ||
                schemaTypeName == null){
            return;
        }
View Full Code Here

        if (schemaObj.version != null) {
            serializedSchema.setAttribute("version", schemaObj.version);
        }

        //add the extra namespace decalarations if any are available
        NamespacePrefixList ctx = schemaObj.getNamespaceContext();
        String[] prefixes = ctx.getDeclaredPrefixes();
        for (int i = 0;  i < prefixes.length;  i++) {
            String prefix = prefixes[i];
            String uri = ctx.getNamespaceURI(prefix);
            if (!Constants.DEFAULT_NS_PREFIX.equals(prefix)) {
                serializedSchema.setAttributeNS(Constants.XMLNS_ATTRIBUTE_NS_URI,
                        Constants.XMLNS_ATTRIBUTE + ":" + prefix, uri);
            }
        }
View Full Code Here

    /**
     * Set up <schema> namespaces appropriately and append that attr
     * into specified element
     */
    private Element setupNamespaces(Document schemaDocs, XmlSchema schemaObj) {
        NamespacePrefixList ctx = schemaObj.getNamespaceContext();
        schemaObj.schema_ns_prefix = xsdPrefix = ctx.getPrefix(xsdNamespace);
        if(xsdPrefix == null) {
            schemaObj.schema_ns_prefix = xsdPrefix = "";
        }
        String[] prefixes = ctx.getDeclaredPrefixes();
        for (int i = 0;  i < prefixes.length;  i++) {
            String prefix = prefixes[i];
            String uri = ctx.getNamespaceURI(prefix);
            schema_ns.put(uri, prefix);
        }
        //for schema that not set the xmlns attrib member
        if (schema_ns.get(xsdNamespace) == null) {
            schema_ns.put(xsdNamespace, xsdPrefix);
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.schema.utils.NamespacePrefixList

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.