Examples of OMNamespaceImpl


Examples of org.apache.axiom.om.impl.common.OMNamespaceImpl

        if (generateNSDecl && attr.getNamespaceURI() != null
                && findNamespace(attr.getNamespaceURI(), attr.getPrefix())
                == null) {
            // TODO checkwhether the same ns is declared with a different
            // prefix and remove it
            this.declareNamespace(new OMNamespaceImpl(attr.getNamespaceURI(),
                                                    attr.getPrefix()));
        }

        return (Attr) this.attributes.setAttribute(attr, useDomSemantics);
    }
View Full Code Here

Examples of org.apache.axiom.om.impl.common.OMNamespaceImpl

            attr.setPrefix(prefix);
            attr.setValue(value);
        } else {
            if (namespaceURI != null) {
                attr = new AttrImpl(ownerDocument(), localName, value, this.factory);
                attr.setOMNamespace(new OMNamespaceImpl(namespaceURI, prefix));
   
                this.setAttributeNodeNS(attr);
            } else {
                // When the namespace is null, the attr name given better not be
                // a qualified name
View Full Code Here

Examples of org.apache.axiom.om.impl.common.OMNamespaceImpl

        return addAttribute(new AttrImpl(null, localName, ns, value, factory));
    }

    public OMNamespace addNamespaceDeclaration(String uri, String prefix) {
        setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, prefix.length() == 0 ? XMLConstants.XMLNS_ATTRIBUTE : XMLConstants.XMLNS_ATTRIBUTE + ":" + prefix, uri);
        return new OMNamespaceImpl(uri, prefix);
    }
View Full Code Here

Examples of org.apache.axiom.om.impl.common.OMNamespaceImpl

    public OMNamespace declareNamespace(OMNamespace namespace) {
        if (namespace != null) {
            String prefix = namespace.getPrefix();
            if (prefix == null) {
                prefix = OMSerializerUtil.getNextNSPrefix();
                namespace = new OMNamespaceImpl(namespace.getNamespaceURI(), prefix);
            }
            if (prefix.length() > 0 && namespace.getNamespaceURI().length() == 0) {
                throw new IllegalArgumentException("Cannot bind a prefix to the empty namespace name");
            }
View Full Code Here

Examples of org.apache.axiom.om.impl.common.OMNamespaceImpl

        if ("".equals(prefix)) {
            log.warn("Deprecated usage of OMElement#declareNamespace(String,String) with empty prefix");
            prefix = OMSerializerUtil.getNextNSPrefix();
        }
       
        OMNamespaceImpl ns = new OMNamespaceImpl(uri, prefix);
        return declareNamespace(ns);
    }
View Full Code Here

Examples of org.apache.axiom.om.impl.common.OMNamespaceImpl

            throw new OMException("Attempt to add a namespace declaration that conflicts with " +
                    "the namespace information of the element");
        }

        setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, XMLConstants.XMLNS_ATTRIBUTE, uri);
        return new OMNamespaceImpl(uri, "");
    }
View Full Code Here

Examples of org.apache.axiom.om.impl.common.OMNamespaceImpl

    public OMNamespace getDefaultNamespace() {
        Attr decl = (Attr)attributes.getNamedItemNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, XMLConstants.XMLNS_ATTRIBUTE);
        if (decl != null) {
            String uri = decl.getValue();
            return uri.length() == 0 ? null : new OMNamespaceImpl(uri, "");
        }

        ParentNode parentNode = parentNode();
        if (parentNode instanceof ElementImpl) {
            ElementImpl element = (ElementImpl) parentNode;
View Full Code Here

Examples of org.apache.axiom.om.impl.common.OMNamespaceImpl

                String namespaceURI = decl.getValue();
                if (prefix != null && prefix.length() > 0 && namespaceURI.length() == 0) {
                    // Prefix undeclaring case (XML 1.1 only)
                    return null;
                } else {
                    return new OMNamespaceImpl(namespaceURI, prefix);
                }
            }
        }
        ParentNode parentNode = parentNode();
        if (parentNode instanceof OMElement) {
View Full Code Here

Examples of org.apache.axiom.om.impl.common.OMNamespaceImpl

    private OMNamespace findDeclaredNamespace(String uri, String prefix) {

        if (uri == null) {
            Attr decl = (Attr)attributes.getNamedItemNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
                    prefix.length() == 0 ? XMLConstants.XMLNS_ATTRIBUTE : prefix);
            return decl == null ? null : new OMNamespaceImpl(decl.getValue(), prefix);
        }
        // If the prefix is available and uri is available and its the xml
        // namespace
        if (prefix != null && prefix.equals(OMConstants.XMLNS_PREFIX)
                && uri.equals(OMConstants.XMLNS_URI)) {
            return new OMNamespaceImpl(uri, prefix);
        }

        if (prefix == null || "".equals(prefix)) {
            for (int i=0; i<attributes.getLength(); i++) {
                Attr attr = (Attr)attributes.item(i);
                if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI())) {
                    String declaredUri = attr.getValue();
                    if (declaredUri.equals(uri)) {
                        return new OMNamespaceImpl(uri, attr.getPrefix() == null ? "" : attr.getLocalName());
                    }
                }
            }
        } else {
            Attr decl = (Attr)attributes.getNamedItemNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, prefix);
            if (decl != null) {
                String declaredUri = decl.getValue();
                if (declaredUri.equals(uri)) {
                    return new OMNamespaceImpl(uri, prefix);
                }
            }
        }

        return null;
View Full Code Here

Examples of org.apache.axiom.om.impl.common.OMNamespaceImpl

    public OMNamespace declareNamespace(String uri, String prefix) {
        if ("".equals(prefix)) {
            log.warn("Deprecated usage of OMElement#declareNamespace(String,String) with empty prefix");
            prefix = OMSerializerUtil.getNextNSPrefix();
        }
        OMNamespaceImpl ns = new OMNamespaceImpl(uri, prefix);
        return declareNamespace(ns);
    }
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.