Package org.apache.axiom.om.impl.llom

Examples of org.apache.axiom.om.impl.llom.OMSourcedElementImpl$DeferredNamespace


    public void testGetTextAsStreamWithOMSourcedElement() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        DataSource ds = new RandomDataSource(445566, 32, 128, 20000000);
        QName qname = new QName("a");
        Charset cs = Charset.forName("ascii");
        OMSourcedElement element = new OMSourcedElementImpl(qname, factory,
                new WrappedTextNodeOMDataSourceFromDataSource(qname, ds, cs));
        Reader in = ElementHelper.getTextAsStream(element, true);
        assertFalse(in instanceof StringReader);
        compareStreams(new InputStreamReader(ds.getInputStream(), cs), in);
    }
View Full Code Here


   
    public void testWriteTextToWithOMSourcedElement() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        DataSource ds = new RandomDataSource(665544, 32, 128, 20000000);
        QName qname = new QName("a");
        OMSourcedElement element = new OMSourcedElementImpl(qname, factory,
                new WrappedTextNodeOMDataSourceFromDataSource(qname, ds, Charset.forName("ascii")));
        Reader in = new InputStreamReader(ds.getInputStream(), "ascii");
        Writer out = new CharacterStreamComparator(in);
        ElementHelper.writeTextTo(element, out, true); // cache doesn't matter here
        out.close();
View Full Code Here

        }
        String testData = buffer.toString();
        QName qname = new QName("data");
        OMDataSource ds = new WrappedTextNodeOMDataSourceFromReader(qname, new StringReader(testData));
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMSourcedElement element = new OMSourcedElementImpl(qname, factory, ds);
        assertEquals(testData, element.getText());
    }
View Full Code Here

        try {
            reader = new InputStreamReader(inputStream, charSetEnc);
        } catch (UnsupportedEncodingException ex) {
            throw new AxisFault("Unsupported encoding: " + charSetEnc, ex);
        }
        return new OMSourcedElementImpl(wrapperQName, factory,
                new WrappedTextNodeOMDataSourceFromReader(wrapperQName, reader));
    }
View Full Code Here

                                     String contentType,
                                     MessageContext msgContext) throws AxisFault {
       
        OMFactory factory = OMAbstractFactory.getOMFactory();
        QName wrapperQName = getWrapperQName(msgContext);
        return new OMSourcedElementImpl(wrapperQName, factory,
                new WrappedTextNodeOMDataSourceFromReader(wrapperQName, reader));
    }
View Full Code Here

                                     MessageContext msgContext) throws AxisFault {
       
        OMFactory factory = OMAbstractFactory.getOMFactory();
        Charset cs = Charset.forName(BuilderUtil.getCharSetEncoding(contentType));
        QName wrapperQName = getWrapperQName(msgContext);
        return new OMSourcedElementImpl(wrapperQName, factory,
                new WrappedTextNodeOMDataSourceFromDataSource(wrapperQName, dataSource, cs));
    }
View Full Code Here

     * @param source
     * @param localName
     * @param ns
     */
    public OMSourcedElement createOMElement(OMDataSource source, String localName, OMNamespace ns) {
        return new OMSourcedElementImpl(localName, ns, this, source);
    }
View Full Code Here

     *
     * @param source the data source
     * @param qname the name of the element produced by the data source
     */
    public OMSourcedElement createOMElement(OMDataSource source, QName qname) {
        return new OMSourcedElementImpl(qname, this, source);
    }
View Full Code Here

    public void testGetTextAsStreamWithOMSourcedElement() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        DataSource ds = new RandomDataSource(445566, 32, 128, 20000000);
        QName qname = new QName("a");
        Charset cs = Charset.forName("ascii");
        OMSourcedElement element = new OMSourcedElementImpl(qname, factory,
                new WrappedTextNodeOMDataSourceFromDataSource(qname, ds, cs));
        Reader in = ElementHelper.getTextAsStream(element, true);
        assertFalse(in instanceof StringReader);
        IOTestUtils.compareStreams(new InputStreamReader(ds.getInputStream(), cs), in);
    }
View Full Code Here

   
    public void testWriteTextToWithOMSourcedElement() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        DataSource ds = new RandomDataSource(665544, 32, 128, 20000000);
        QName qname = new QName("a");
        OMSourcedElement element = new OMSourcedElementImpl(qname, factory,
                new WrappedTextNodeOMDataSourceFromDataSource(qname, ds, Charset.forName("ascii")));
        Reader in = new InputStreamReader(ds.getInputStream(), "ascii");
        Writer out = new CharacterStreamComparator(in);
        ElementHelper.writeTextTo(element, out, true); // cache doesn't matter here
        out.close();
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.impl.llom.OMSourcedElementImpl$DeferredNamespace

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.