Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMNode


        if (cache) {
            element.build();
        }

        serializeStartpart(element, writer);
        OMNode firstChild = element.getFirstOMChild();
        if (firstChild != null) {
            if (cache) {
                (firstChild).serialize(writer);
            } else {
                (firstChild).serializeAndConsume(writer);
View Full Code Here


        }
        OMElement existingDocumentElement = getOMDocumentElement();
        if (existingDocumentElement == null) {
            addChild(documentElement);
        } else {
            OMNode nextSibling = existingDocumentElement.getNextOMSibling();
            existingDocumentElement.detach();
            if (nextSibling == null) {
                addChild(documentElement);
            } else {
                nextSibling.insertSiblingBefore(documentElement);
            }
        }
    }
View Full Code Here

    public OMElement getOMDocumentElement() {
        return getOMDocumentElement(true);
    }

    OMElement getOMDocumentElement(boolean build) {
        OMNode child = build ? getFirstOMChild() : getFirstOMChildIfAvailable();
        while (child != null) {
            if (child instanceof OMElement) {
                return (OMElement)child;
            }
            child = build ? child.getNextOMSibling() : ((OMNodeEx)child).getNextOMSiblingIfAvailable();
        }
        return null;
    }
View Full Code Here

     */
    public static OMElement getChildWithName(OMElement parent,
                                             String childName) {
        Iterator childrenIter = parent.getChildren();
        while (childrenIter.hasNext()) {
            OMNode node = (OMNode) childrenIter.next();
            if (node.getType() == OMNode.ELEMENT_NODE &&
                    childName.equals(((OMElement) node).getLocalName())) {
                return (OMElement) node;
            }
        }
        return null;
View Full Code Here

    public OMXMLParserWrapper getBuilder() {
        return builder;
    }

    public OMElement getOMDocumentElement() {
        OMNode child = getFirstOMChild();
        while (child != null) {
            if (child instanceof OMElement) {
                return (OMElement)child;
            }
            child = child.getNextOMSibling();
        }
        return null;
    }
View Full Code Here

        }
        OMElement existingDocumentElement = getOMDocumentElement();
        if (existingDocumentElement == null) {
            addChild(documentElement);
        } else {
            OMNode nextSibling = existingDocumentElement.getNextOMSibling();
            existingDocumentElement.detach();
            if (nextSibling == null) {
                addChild(documentElement);
            } else {
                nextSibling.insertSiblingBefore(documentElement);
            }
        }
    }
View Full Code Here

     */
    public OMElement getFirstChildWithName(QName elementQName) throws OMException {
        OMChildrenQNameIterator omChildrenQNameIterator =
                new OMChildrenQNameIterator(getFirstOMChild(),
                                            elementQName);
        OMNode omNode = null;
        if (omChildrenQNameIterator.hasNext()) {
            omNode = (OMNode) omChildrenQNameIterator.next();
        }

        return ((omNode != null) && (OMNode.ELEMENT_NODE == omNode.getType())) ?
                (OMElement) omNode : null;

    }
View Full Code Here

        CharArrayDataSource cads = new CharArrayDataSource(payload1.toCharArray());

        OMElement parent = factory.createOMElement("root", null);
        OMSourcedElement omse = factory.createOMElement(cads, localName, ns);
        parent.addChild(omse);
        OMNode firstChild = parent.getFirstOMChild();
        assertTrue("Expected OMSourcedElement child", firstChild instanceof OMSourcedElement);
        OMSourcedElement child = (OMSourcedElement) firstChild;
        assertTrue("OMSourcedElement is expanded.  This is unexpected", !child.isExpanded());
        assertTrue("OMSourcedElement should be backed by a ByteArrayDataSource",
                   child.getDataSource() instanceof CharArrayDataSource);
View Full Code Here

    void notifyChildComplete() {
        if (state == INCOMPLETE && builder == null) {
            Iterator iterator = getChildren();
            while (iterator.hasNext()) {
                OMNode node = (OMNode) iterator.next();
                if (!node.isComplete()) {
                    return;
                }
            }
            this.setComplete(true);
        }
View Full Code Here

                          OMNamespace ns =  (OMNamespace) nsIter.next();
                          header.declareNamespace(ns);
                        }
                        Iterator children = element.getChildElements();
                        while (children.hasNext()) {
                          OMNode child = (OMNode)children.next();
                          child.detach();
                          header.addChild(child);
                        }
                       
                        element.detach();
                       
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.OMNode

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.