Package org.apache.ws.commons.om.impl.builder

Examples of org.apache.ws.commons.om.impl.builder.StAXOMBuilder


                (SOAPEnvelope) OMTestUtils.getOMBuilder(
                        new File(dir, TestConstants.SOAPMESSAGE))
                        .getDocumentElement();
        SOAPBody body = soapEnvelope.getBody();

        OMElement firstClonedBodyElement = new StAXOMBuilder(body.getXMLStreamReader()).getDocumentElement();
        OMElement secondClonedBodyElement = new StAXOMBuilder(body.getXMLStreamReader()).getDocumentElement();

        // first check whether both have the same information
        assertXMLEqual(newDocument(body.toString()), newDocument(firstClonedBodyElement.toString()));
        assertXMLEqual(newDocument(body.toString()), newDocument(secondClonedBodyElement.toString()));
        assertXMLEqual(newDocument(firstClonedBodyElement.toString()), newDocument(secondClonedBodyElement.toString()));
View Full Code Here


    public Object getDocument(String uri) throws Exception {
        try {
            XMLStreamReader parser =
                    XMLInputFactory.newInstance().createXMLStreamReader(
                            new FileInputStream(uri));
            StAXOMBuilder builder =
                    new StAXOMBuilder(parser);
            return builder.getDocumentElement();
        } catch (Exception e) {
            throw new FunctionCallException(e);
        }
    }
View Full Code Here

            } else {
                URL url = new URL(uri);
                parser = xmlInputFactory.createXMLStreamReader(
                                url.openStream());
            }
            StAXOMBuilder builder =
                    new StAXOMBuilder(parser);
            return builder.getDocumentElement().getParent();
        } catch (Exception e) {
            throw new FunctionCallException(e);
        }
    }
View Full Code Here

     * @param parser
     * @return Returns StAXOMBuilder.
     */
    public static StAXOMBuilder createStAXOMBuilder(OMFactory ombuilderFactory,
                                                    XMLStreamReader parser) {
        return new StAXOMBuilder(ombuilderFactory, parser);
    }
View Full Code Here

        ElementHelper helper = new ElementHelper(this);
        return helper.resolveQName(qname);
    }

    public OMElement cloneOMElement() {
        OMElement clonedElement = new StAXOMBuilder(this.getXMLStreamReader(true)).getDocumentElement();
        clonedElement.build();
        return clonedElement;
    }
View Full Code Here

     * Creates a clone which belongs to a new document.
     *
     * @see org.apache.ws.commons.om.OMElement#cloneOMElement()
     */
    public OMElement cloneOMElement() {
        ElementImpl elem = (ElementImpl) (new StAXOMBuilder(new OMDOMFactory(),
                this.getXMLStreamReader(true))).getDocumentElement();
        return elem;
    }
View Full Code Here

        XMLStreamReader xmlReader =
            XMLInputFactory.newInstance().createXMLStreamReader(
                new ByteArrayInputStream(str.getBytes()));
        OMFactory fac = OMAbstractFactory.getOMFactory();

        StAXOMBuilder staxOMBuilder =
            new StAXOMBuilder(fac, xmlReader);
        return staxOMBuilder.getDocumentElement();
    }
View Full Code Here

                bodyContent = fac.createOMElement(
                        method.getName() + "Response", ns);
                // Java Beans
                XMLStreamReader xr = BeanUtil.getPullParser(resObject,
                        new QName(RETURN_WRAPPER));
                StAXOMBuilder stAXOMBuilder =
                        OMXMLBuilderFactory.createStAXOMBuilder(
                                OMAbstractFactory.getOMFactory(), xr);
                OMElement documentElement = stAXOMBuilder.getDocumentElement();
                if (documentElement != null) {
                    bodyContent.addChild(documentElement);
                }
            }
        }
View Full Code Here

        try {
            OMDOMFactory factory = new OMDOMFactory();
            // Not really sure whether this will work :-?
            XMLStreamReader reader = XMLInputFactory.newInstance()
                    .createXMLStreamReader(inputSource.getCharacterStream());
            StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
            DocumentImpl doc = (DocumentImpl) builder.getDocument();
            ((ElementImpl) doc.getDocumentElement()).build();
            return (DocumentImpl) builder.getDocument();
        } catch (XMLStreamException e) {
            throw new SAXException(e);
        }
    }
View Full Code Here

    public Document parse(InputStream is) throws SAXException, IOException {
        try {
            OMDOMFactory factory = new OMDOMFactory();
            XMLStreamReader reader = XMLInputFactory.newInstance()
                    .createXMLStreamReader(is);
            StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
            return (DocumentImpl) builder.getDocument();
        } catch (XMLStreamException e) {
            throw new SAXException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.om.impl.builder.StAXOMBuilder

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.