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

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


      attr.setAnnotation(annotation);
    }

    NamedNodeMap attrNodes = attrEl.getAttributes();
    Vector attrs = new Vector();
    NodeNamespaceContext ctx = null;
    for (int i = 0; i < attrNodes.getLength(); i++) {
      Attr att = (Attr) attrNodes.item(i);
      String attName = att.getName();
      if (!attName.equals("name") && !attName.equals("type")
          && !attName.equals("default") && !attName.equals("fixed")
          && !attName.equals("form") && !attName.equals("id")
          && !attName.equals("use") && !attName.equals("ref")) {

        attrs.add(att);
        String value = att.getValue();

        if (value.indexOf(":") > -1) {
          // there is a possiblily of some namespace mapping
          String prefix = value.substring(0, value.indexOf(":"));
          if (ctx == null) {
            ctx = NodeNamespaceContext.getNamespaceContext(attrEl);
          }
          String namespace = ctx.getNamespaceURI(prefix);
          if (!Constants.NULL_NS_URI.equals(namespace)) {
            Attr nsAttr = attrEl.getOwnerDocument()
                .createAttribute("xmlns:" + prefix);
            nsAttr.setValue(namespace);
            attrs.add(nsAttr);
View Full Code Here


     * @param schemaEl
     * @param uri
     */
    XmlSchema handleXmlSchemaElement(Element schemaEl, String uri) {
        // get all the attributes along with the namespace declns
        schema.setNamespaceContext(new NodeNamespaceContext(schemaEl));
        setNamespaceAttributes(schema, schemaEl);

        XmlSchemaCollection.SchemaKey schemaKey = new XmlSchemaCollection.SchemaKey(schema.logicalTargetNamespace, uri);
        if (!collection.containsSchema(schemaKey)) {
            collection.addSchema(schemaKey, schema);
View Full Code Here

            Element inlineSimpleType =
                    XDOMUtil.getFirstChildElementNS(restrictionEl,
                            XmlSchema.SCHEMA_NS, "simpleType");

            if (restrictionEl.hasAttribute("base")) {
                NamespaceContext ctx = new NodeNamespaceContext(restrictionEl);
                restriction.baseTypeName = getRefQName(restrictionEl.getAttribute("base"), ctx);
            } else if (inlineSimpleType != null) {

                restriction.baseType = handleSimpleType(schema, inlineSimpleType, schemaEl);
            }
View Full Code Here

        return simpleType;
    }

    private QName getRefQName(String pName, Node pNode) {
        return getRefQName(pName, new NodeNamespaceContext(pNode));
    }
View Full Code Here

            attr.setAnnotation(annotation);
        }

        NamedNodeMap attrNodes = attrEl.getAttributes();
        Vector attrs = new Vector();
        NodeNamespaceContext ctx = null;
        for (int i = 0; i < attrNodes.getLength(); i++) {
            Attr att = (Attr) attrNodes.item(i);
            String attName = att.getName();
            if (!attName.equals("name") &&
                    !attName.equals("type") &&
                    !attName.equals("default") &&
                    !attName.equals("fixed") &&
                    !attName.equals("form") &&
                    !attName.equals("id") &&
                    !attName.equals("use") &&
                    !attName.equals("ref")) {


                attrs.add(att);
                String value = att.getValue();

                if (value.indexOf(":") > -1) {
                    // there is a possiblily of some namespace mapping
                    String prefix = value.substring(0, value.indexOf(":"));
                    if (ctx == null) {
                        ctx = new NodeNamespaceContext(attrEl);
                    }
                    String namespace = ctx.getNamespaceURI(prefix);
                    if (!Constants.NULL_NS_URI.equals(namespace)) {
                        Attr nsAttr = attrEl.getOwnerDocument().createAttribute("xmlns:" + prefix);
                        nsAttr.setValue(namespace);
                        attrs.add(nsAttr);
                    }
View Full Code Here

     * @param schemaEl
     * @param uri
     */
    XmlSchema handleXmlSchemaElement(Element schemaEl, String uri) {
        // get all the attributes along with the namespace declns
        schema.setNamespaceContext(new NodeNamespaceContext(schemaEl));
        setNamespaceAttributes(schema, schemaEl);

        XmlSchemaCollection.SchemaKey schemaKey = new XmlSchemaCollection.SchemaKey(schema.logicalTargetNamespace, uri);
        if (!collection.containsSchema(schemaKey)) {
            collection.addSchema(schemaKey, schema);
View Full Code Here

            Element inlineSimpleType =
                    XDOMUtil.getFirstChildElementNS(restrictionEl,
                            XmlSchema.SCHEMA_NS, "simpleType");

            if (restrictionEl.hasAttribute("base")) {
              NamespaceContext ctx = new NodeNamespaceContext(restrictionEl);
              restriction.baseTypeName = getRefQName(restrictionEl.getAttribute("base"), ctx);
            } else if (inlineSimpleType != null) {

                restriction.baseType = handleSimpleType(schema, inlineSimpleType, schemaEl);
            }
View Full Code Here

        return simpleType;
    }

    private QName getRefQName(String pName, Node pNode) {
        return getRefQName(pName, new NodeNamespaceContext(pNode));
    }
View Full Code Here

            attr.setAnnotation(annotation);
        }

        NamedNodeMap attrNodes = attrEl.getAttributes();
        Vector attrs = new Vector();
        NodeNamespaceContext ctx = null;
        for (int i = 0; i < attrNodes.getLength(); i++) {
            Attr att = (Attr) attrNodes.item(i);
            String attName = att.getName();
            if (!attName.equals("name") &&
                    !attName.equals("type") &&
                    !attName.equals("default") &&
                    !attName.equals("fixed") &&
                    !attName.equals("form") &&
                    !attName.equals("id") &&
                    !attName.equals("use") &&
                    !attName.equals("ref")) {


                attrs.add(att);
                String value = att.getValue();

                if (value.indexOf(":") > -1) {
                    // there is a possiblily of some namespace mapping
                    String prefix = value.substring(0, value.indexOf(":"));
                    if (ctx == null) {
                        ctx = new NodeNamespaceContext(attrEl);
                    }
                    String namespace = ctx.getNamespaceURI(prefix);
                    if (!Constants.NULL_NS_URI.equals(namespace)) {
                        Attr nsAttr = attrEl.getOwnerDocument().createAttribute("xmlns:" + prefix);
                        nsAttr.setValue(namespace);
                        attrs.add(nsAttr);
                    }
View Full Code Here

     * @param schemaEl
     * @param uri
     */
    XmlSchema handleXmlSchemaElement(Element schemaEl, String uri) {
        // get all the attributes along with the namespace declns
        schema.setNamespaceContext(new NodeNamespaceContext(schemaEl));
        setNamespaceAttributes(schema, schemaEl);

        XmlSchemaCollection.SchemaKey schemaKey = new XmlSchemaCollection.SchemaKey(schema.logicalTargetNamespace, uri);
        if (!collection.containsSchema(schemaKey)) {
            collection.addSchema(schemaKey, schema);
View Full Code Here

TOP

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

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.