Package org.apache.axiom.om.impl.dom.factory

Examples of org.apache.axiom.om.impl.dom.factory.OMDOMFactory


import org.w3c.dom.Element;
import org.w3c.dom.Text;

public class TextImplTest extends AbstractTestCase {
    public void testAppendText() {
        OMDOMFactory factory = new OMDOMFactory();
        String localName = "TestLocalName";
        String namespace = "http://ws.apache.org/axis2/ns";
        String prefix = "axis2";
        String tempText = "The quick brown fox jumps over the lazy dog";
        String textToAppend = " followed by another fox";

        OMElement elem = factory.createOMElement(localName, namespace, prefix);
        OMText textNode = factory.createOMText(elem, tempText);

        ((Text) textNode).appendData(textToAppend);

        assertEquals("Text value mismatch", tempText + textToAppend, textNode
                .getText());
View Full Code Here


     * Returns a new document impl.
     *
     * @see javax.xml.parsers.DocumentBuilder#newDocument()
     */
    public Document newDocument() {
        OMDOMFactory factory = new OMDOMFactory();
        DocumentImpl documentImpl = new DocumentImpl(factory);
        documentImpl.setComplete(true);
        return documentImpl;
    }
View Full Code Here

    }

    public Document parse(InputSource inputSource) throws SAXException,
            IOException {
        try {
            OMDOMFactory factory = new OMDOMFactory();
            // Not really sure whether this will work :-?
            XMLStreamReader reader = StAXUtils
                    .createXMLStreamReader(inputSource.getCharacterStream());
            StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
            DocumentImpl doc = (DocumentImpl) builder.getDocument();
View Full Code Here

    }

    /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream) */
    public Document parse(InputStream is) throws SAXException, IOException {
        try {
            OMDOMFactory factory = new OMDOMFactory();
            XMLStreamReader reader = StAXUtils
                    .createXMLStreamReader(is);
            StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
            DocumentImpl doc = (DocumentImpl) builder.getDocument();
            doc.close(true);
View Full Code Here

import org.xml.sax.InputSource;

public class TransformTest extends TestCase {
   
    public void testTransform() throws Exception {
        OMFactory fac = new OMDOMFactory();
        OMDocument doc = fac.createOMDocument();
        OMElement element = fac.createOMElement(new QName("http://foo", "bar"));
        OMText text = fac.createOMText("test");
        element.addChild(text);
        doc.addChild(element);

        Document domDoc1 = ((ElementImpl)element).getOwnerDocument();
        assertNotNull(domDoc1);
View Full Code Here

     * Returns a new document impl.
     *
     * @see javax.xml.parsers.DocumentBuilder#newDocument()
     */
    public Document newDocument() {
        OMDOMFactory factory = new OMDOMFactory();
        DocumentImpl documentImpl = new DocumentImpl(factory);
        documentImpl.setComplete(true);
        return documentImpl;
    }
View Full Code Here

    }

    public Document parse(InputSource inputSource) throws SAXException,
            IOException {
        try {
            OMDOMFactory factory = new OMDOMFactory();
            // Not really sure whether this will work :-?
            XMLStreamReader reader = StAXUtils
                    .createXMLStreamReader(inputSource.getCharacterStream());
            StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
            DocumentImpl doc = (DocumentImpl) builder.getDocument();
View Full Code Here

    }

    /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream) */
    public Document parse(InputStream is) throws SAXException, IOException {
        try {
            OMDOMFactory factory = new OMDOMFactory();
            XMLStreamReader reader = StAXUtils
                    .createXMLStreamReader(is);
            StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
            return (DocumentImpl) builder.getDocument();
        } catch (XMLStreamException e) {
View Full Code Here

    }

    /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.File) */
    public Document parse(File file) throws SAXException, IOException {
        try {
            OMDOMFactory factory = new OMDOMFactory();
            XMLStreamReader reader = StAXUtils
                    .createXMLStreamReader(new FileInputStream(file));
            StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
            return (DocumentImpl) builder.getDocument();
        } catch (XMLStreamException e) {
View Full Code Here

    public void testImport() throws Exception {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        Document doc = dbf.newDocumentBuilder().parse(
                getTestResource("sigEncr.xml"));
        Node n = new OMDOMFactory().getDocument().importNode(doc.getDocumentElement(), true);
        OMTestUtils.compare(doc.getDocumentElement(), (OMElement) n);
    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.impl.dom.factory.OMDOMFactory

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.