Search in sources :

Example 1 with CoreNamespaceDeclaration

use of org.apache.axiom.core.CoreNamespaceDeclaration in project webservices-axiom by apache.

the class NamespaceContextPreservationFilterHandler method attributesCompleted.

@Override
public void attributesCompleted() throws StreamException {
    if (!done) {
        try {
            CoreElement current = contextElement;
            while (true) {
                CoreAttribute attr = current.coreGetFirstAttribute();
                while (attr != null) {
                    if (attr instanceof CoreNamespaceDeclaration) {
                        CoreNamespaceDeclaration decl = (CoreNamespaceDeclaration) attr;
                        String prefix = decl.coreGetDeclaredPrefix();
                        if (prefixesAlreadyBound.add(prefix)) {
                            super.processNamespaceDeclaration(prefix, decl.coreGetCharacterData().toString());
                        }
                    }
                    attr = attr.coreGetNextAttribute();
                }
                CoreParentNode parent = current.coreGetParent();
                if (!(parent instanceof CoreElement)) {
                    break;
                }
                current = (CoreElement) parent;
            }
            prefixesAlreadyBound = null;
            done = true;
        } catch (CoreModelException ex) {
            throw new StreamException(ex);
        }
    }
    super.attributesCompleted();
}
Also used : CoreParentNode(org.apache.axiom.core.CoreParentNode) CoreAttribute(org.apache.axiom.core.CoreAttribute) CoreElement(org.apache.axiom.core.CoreElement) CoreModelException(org.apache.axiom.core.CoreModelException) CoreNamespaceDeclaration(org.apache.axiom.core.CoreNamespaceDeclaration) StreamException(org.apache.axiom.core.stream.StreamException)

Example 2 with CoreNamespaceDeclaration

use of org.apache.axiom.core.CoreNamespaceDeclaration in project webservices-axiom by apache.

the class BuildableContext method processNamespaceDeclaration.

@Override
void processNamespaceDeclaration(String prefix, String namespaceURI) throws StreamException {
    if (passThroughHandler != null) {
        passThroughHandler.processNamespaceDeclaration(prefix, namespaceURI);
    } else {
        CoreNamespaceDeclaration decl = builderHandler.nodeFactory.createNode(CoreNamespaceDeclaration.class);
        decl.init(prefix, namespaceURI, builderHandler.namespaceHelper);
        ((CoreElement) target).coreAppendAttribute(decl);
    }
}
Also used : CoreElement(org.apache.axiom.core.CoreElement) CoreNamespaceDeclaration(org.apache.axiom.core.CoreNamespaceDeclaration)

Aggregations

CoreElement (org.apache.axiom.core.CoreElement)2 CoreNamespaceDeclaration (org.apache.axiom.core.CoreNamespaceDeclaration)2 CoreAttribute (org.apache.axiom.core.CoreAttribute)1 CoreModelException (org.apache.axiom.core.CoreModelException)1 CoreParentNode (org.apache.axiom.core.CoreParentNode)1 StreamException (org.apache.axiom.core.stream.StreamException)1