Package org.apache.axiom.om.ds

Examples of org.apache.axiom.om.ds.CharArrayDataSource


    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMNamespace ns = factory.createOMNamespace("", "");
        OMSourcedElement element = factory.createOMElement(new CharArrayDataSource(
                "<element>content</element>".toCharArray()), "element", ns);
        // This actually returns the "declared" namespace because the sourced element is not
        // expanded yet. Nevertheless the value should have been normalized to null.
        assertNull(element.getNamespace());
        // Now expand the element and check getNamespace() again
View Full Code Here


       
        String localName = "myPayload";
        String encoding = "utf-8";
        String payload1 = "<tns:myPayload xmlns:tns=\"urn://test\">Payload One</tns:myPayload>";
        OMNamespace ns = factory.createOMNamespace("urn://test", "tns");
        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();
View Full Code Here

        assertNull(element.getNextOMSibling());
        assertFalse(element.isExpanded());
    }

    public void testSerializeModifiedOMSEWithNonDestructiveDataSource() throws Exception {
        OMDataSourceExt ds = new CharArrayDataSource("<element><child/></element>".toCharArray());
        assertFalse(ds.isDestructiveWrite());
       
        OMFactory f = new OMLinkedListImplFactory();
        OMElement element = new OMSourcedElementImpl("element", null, f, ds);
       
        element.getFirstElement().setText("TEST");
View Full Code Here

        super(metaFactory);
    }

    protected void runTest() throws Throwable {
        OMFactory omFactory = metaFactory.getOMFactory();
        OMDataSource ds = new CharArrayDataSource("<a>test</a>".toCharArray());
        OMElement root = omFactory.createOMElement(new QName("root"));
        OMSourcedElement child = omFactory.createOMElement(ds, "a", null);
        root.addChild(child);
        assertFalse(child.isExpanded());
        XMLStreamReader stream = root.getXMLStreamReader();
View Full Code Here

        super(metaFactory);
    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMSourcedElement element = factory.createOMElement(new CharArrayDataSource(
                "<element>content</element>".toCharArray()), new QName("element"));
        assertNull(element.getNamespace());
        // Expand the element
        element.getFirstOMChild();
        assertNull(element.getNamespace());
View Full Code Here

        assertNull(element.getNextOMSibling());
        assertFalse(element.isExpanded());
    }

    public void testSerializeModifiedOMSEWithNonDestructiveDataSource() throws Exception {
        OMDataSourceExt ds = new CharArrayDataSource("<element><child/></element>".toCharArray());
        assertFalse(ds.isDestructiveWrite());
       
        OMFactory f = new OMLinkedListImplFactory();
        OMElement element = new OMSourcedElementImpl("element", null, f, ds);
       
        element.getFirstElement().setText("TEST");
View Full Code Here

        bads2 = new ByteArrayDataSource(payload2.getBytes(ENCODING), ENCODING);
        ByteArrayInputStream bais1 = new ByteArrayInputStream(payload1.getBytes(ENCODING));
        ByteArrayInputStream bais2 = new ByteArrayInputStream(payload2.getBytes(ENCODING));
        isds1 = new InputStreamDataSource(bais1, ENCODING);
        isds2 = new InputStreamDataSource(bais2, ENCODING);
        cads = new CharArrayDataSource(payload1.toCharArray());
        ns = soapFactory.createOMNamespace("urn://test", "tns");
    }
View Full Code Here

        super(metaFactory);
    }

    protected void runTest() throws Throwable {
        OMFactory omFactory = metaFactory.getOMFactory();
        OMDataSource ds = new CharArrayDataSource("<a>test</a>".toCharArray());
        OMElement root = omFactory.createOMElement(new QName("root"));
        OMSourcedElement child = omFactory.createOMElement(ds, "a", null);
        root.addChild(child);
        assertFalse(child.isExpanded());
        XMLStreamReader stream = root.getXMLStreamReader();
View Full Code Here

        bads2 = new ByteArrayDataSource(payload2.getBytes(ENCODING), ENCODING);
        ByteArrayInputStream bais1 = new ByteArrayInputStream(payload1.getBytes(ENCODING));
        ByteArrayInputStream bais2 = new ByteArrayInputStream(payload2.getBytes(ENCODING));
        isds1 = new InputStreamDataSource(bais1, ENCODING);
        isds2 = new InputStreamDataSource(bais2, ENCODING);
        cads = new CharArrayDataSource(payload1.toCharArray());
        ns = soapFactory.createOMNamespace("urn://test", "tns");
    }
View Full Code Here

    public TestSerializeModifiedOMSEWithNonDestructiveDataSource(OMMetaFactory metaFactory) {
        super(metaFactory);
    }

    protected void runTest() throws Throwable {
        OMDataSourceExt ds = new CharArrayDataSource("<element><child/></element>".toCharArray());
        assertFalse(ds.isDestructiveWrite());
       
        OMFactory f = metaFactory.getOMFactory();
        OMElement element = f.createOMElement(ds, "element", null);
       
        element.getFirstElement().setText("TEST");
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.ds.CharArrayDataSource

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.