Examples of OMDocument


Examples of org.apache.axiom.om.OMDocument

                                     XMLStreamWriter writer)
    throws XMLStreamException {
        StAXOMBuilder builder = new StAXOMBuilder(reader);
        builder.releaseParserOnClose(true);
        try {
            OMDocument omDocument = builder.getDocument();
            Iterator it = omDocument.getChildren();
            while (it.hasNext()) {
                OMNode omNode = (OMNode) it.next();
                omNode.serializeAndConsume(writer);
            }
        } finally {
View Full Code Here

Examples of org.apache.axiom.om.OMDocument

    public void removeChildren() {
        OMContainerHelper.removeChildren(this);
    }

    public OMInformationItem clone(OMCloneOptions options) {
        OMDocument targetDocument;
        if (options.isPreserveModel()) {
            targetDocument = createClone(options);
        } else {
            targetDocument = getOMFactory().createOMDocument();
        }
        targetDocument.setXMLVersion(xmlVersion);
        targetDocument.setXMLEncoding(xmlEncoding);
        targetDocument.setCharsetEncoding(charSetEncoding);
        targetDocument.setStandalone(isStandalone);
        for (Iterator it = getChildren(); it.hasNext(); ) {
            ((OMNodeImpl)it.next()).clone(options, targetDocument);
        }
        return targetDocument;
    }
View Full Code Here

Examples of org.apache.axiom.om.OMDocument

        namespaceURIInterning = false;
        lookAheadToken = -1;
    }

    private OMDocument createDocument() {
        OMDocument document = omfactory.createOMDocument(this);
        if (charEncoding != null) {
            document.setCharsetEncoding(charEncoding);
        }
        if (parser.getEventType() == XMLStreamConstants.START_DOCUMENT) {
            document.setXMLVersion(parser.getVersion());
            document.setStandalone(parser.isStandalone() ? "yes" : "no");
        } else {
            // We allow creating a StAXOMWrapper from a parser in state START_ELEMENT. In that
            // case, we must not call getVersion or isStandalone since this is forbidden by the
            // StAX specs. Set some reasonable defaults.
            document.setXMLVersion("1.0");
            document.setStandalone("yes");
        }
        return document;
    }
View Full Code Here

Examples of org.apache.axiom.om.OMDocument

    public void testSerializeToXMLWriterFromReader() throws Exception {
        StringWriter writer = new StringWriter();
        XMLStreamWriter xmlwriter = StAXUtils.createXMLStreamWriter(writer);

        StAXOMBuilder builder = new StAXOMBuilder(element.getXMLStreamReader());
        OMDocument omDocument = builder.getDocument();
        Iterator it = omDocument.getChildren();
        while (it.hasNext()) {
            OMNode omNode = (OMNode) it.next();
            // TODO: quick fix required because OMChildrenIterator#next() no longer builds the node
            omNode.getNextOMSibling();
            omNode.serializeAndConsume(xmlwriter);
View Full Code Here

Examples of org.apache.axiom.om.OMDocument

    public void testSerializeToXMLWriterFromReaderEmbedded() throws Exception {
        StringWriter writer = new StringWriter();
        XMLStreamWriter xmlwriter = StAXUtils.createXMLStreamWriter(writer);

        StAXOMBuilder builder = new StAXOMBuilder(root.getXMLStreamReader());
        OMDocument omDocument = builder.getDocument();
        Iterator it = omDocument.getChildren();
        while (it.hasNext()) {
            OMNode omNode = (OMNode) it.next();
            // TODO: quick fix required because OMChildrenIterator#next() no longer builds the node
            omNode.getNextOMSibling();
            omNode.serializeAndConsume(xmlwriter);
View Full Code Here

Examples of org.apache.axiom.om.OMDocument

        StringWriter writer = new StringWriter();
        XMLStreamWriter xmlwriter = StAXUtils.createXMLStreamWriter(writer);

        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(
                metaFactory.getOMFactory(), element.getXMLStreamReader());
        OMDocument omDocument = builder.getDocument();
        Iterator it = omDocument.getChildren();
        while (it.hasNext()) {
            OMNode omNode = (OMNode) it.next();
            // TODO: quick fix required because OMChildrenIterator#next() no longer builds the node
            omNode.getNextOMSibling();
            omNode.serializeAndConsume(xmlwriter);
View Full Code Here

Examples of org.apache.axiom.om.OMDocument

        super(metaFactory);
    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMDocument document = OMXMLBuilderFactory.createOMBuilder(factory, new StringReader(
                "<root><a>text</a></root>")).getDocument();
        OMElement element = document.getOMDocumentElement();
        element.discard();
        assertNull(document.getFirstOMChild());
    }
View Full Code Here

Examples of org.apache.axiom.om.OMDocument

    private static void reader2writer(XMLStreamReader reader,
                                     XMLStreamWriter writer) throws XMLStreamException {
        StAXOMBuilder builder = new StAXOMBuilder(reader);
        builder.releaseParserOnClose(true);
        try {
            OMDocument omDocument = builder.getDocument();
            Iterator it = omDocument.getChildren();
            while (it.hasNext()) {
                // TODO: this is extremely inefficient since next() will actually build the node!
                OMNode omNode = (OMNode) it.next();
                // TODO: quick fix required because OMChildrenIterator#next() no longer builds the node
                omNode.getNextOMSibling();
View Full Code Here

Examples of org.apache.axiom.om.OMDocument

     */
    public void outputTo(XMLStreamWriter writer) throws XMLStreamException {
        // Using OM to convert the reader to a writer.  This seems to be
        // the safest way to make the conversion, and it promotes code re-use.
        StAXOMBuilder builder = new StAXOMBuilder(reader);
        OMDocument omDocument = builder.getDocument();
        Iterator it = omDocument.getChildren();
        while (it.hasNext()) {
            OMNode omNode = (OMNode)it.next();
            omNode.serializeAndConsume(writer);
        }
        // Close the reader if marked to do so
View Full Code Here

Examples of org.apache.axiom.om.OMDocument

        // get the correct SOAP factory to be used
        SOAPFactory factory = (
            soapVersion == SOAP11 ? OMAbstractFactory.getSOAP11Factory() : OMAbstractFactory.getSOAP12Factory());

        // create the SOAP fault document and envelope
        OMDocument soapFaultDocument = factory.createOMDocument();
        SOAPEnvelope faultEnvelope = factory.getDefaultFaultEnvelope();
        soapFaultDocument.addChild(faultEnvelope);

        // create the fault element
        SOAPFault fault = factory.createSOAPFault();

        // populate it
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.