Examples of createXMLStreamReader()


Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()

            XMLInputFactory factory = getXMLInputFactory();
            try {
                XMLStreamReader reader = null;
           
                try {
                    reader = factory.createXMLStreamReader(source);
                } catch (UnsupportedOperationException e) {
                    //ignore
                }
                if (reader == null && source instanceof StreamSource) {
                    //createXMLStreamReader from Source is optional, we'll try and map it
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()

                }
                if (reader == null && source instanceof StreamSource) {
                    //createXMLStreamReader from Source is optional, we'll try and map it
                    StreamSource ss = (StreamSource)source;
                    if (ss.getInputStream() != null) {
                        reader = factory.createXMLStreamReader(ss.getSystemId(),
                                                               ss.getInputStream());
                    } else {
                        reader = factory.createXMLStreamReader(ss.getSystemId(),
                                                               ss.getReader());
                    }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()

                    StreamSource ss = (StreamSource)source;
                    if (ss.getInputStream() != null) {
                        reader = factory.createXMLStreamReader(ss.getSystemId(),
                                                               ss.getInputStream());
                    } else {
                        reader = factory.createXMLStreamReader(ss.getSystemId(),
                                                               ss.getReader());
                    }
                }
                return reader;
            } finally {
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()

     * @param reader
     */
    public static XMLStreamReader createXMLStreamReader(Reader reader) {
        XMLInputFactory factory = getXMLInputFactory();
        try {
            return factory.createXMLStreamReader(reader);
        } catch (XMLStreamException e) {
            throw new RuntimeException("Couldn't parse stream.", e);
        } finally {
            returnXMLInputFactory(factory);
        }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()

                    xreader = StaxUtils.createXMLStreamReader(is, encoding);
                }
            } else {
                synchronized (factory) {
                    if (reader != null) {
                        xreader = factory.createXMLStreamReader(reader);
                    } else {
                        xreader = factory.createXMLStreamReader(is, encoding);
                    }
                }               
            }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()

            } else {
                synchronized (factory) {
                    if (reader != null) {
                        xreader = factory.createXMLStreamReader(reader);
                    } else {
                        xreader = factory.createXMLStreamReader(is, encoding);
                    }
                }               
            }
            xreader = StaxUtils.configureReader(xreader, message);
        } catch (XMLStreamException e) {
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()

    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
        XMLStreamReader reader = factory.createXMLStreamReader(new StringReader("<root><![CDATA[X]]></root>"));
        reader.nextTag();
        reader.next();
        assertTrue(reader.isCharacters());
    }
}
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()

        super(staxImpl);
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(new StringReader("<root/>"));
        reader.nextTag();
        NamespaceContextTestUtils.checkImplicitNamespaces(reader.getNamespaceContext());
    }
}
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()

        this(staxImpl, javaEncoding, new String[] { xmlEncoding });
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(new ByteArrayInputStream(
                "<?xml version=\"1.0\"?><root/>".getBytes(javaEncoding)));
        String actualEncoding = reader.getEncoding();
        assertTrue("Expected one of " + xmlEncodings + ", but got " + actualEncoding,
                   xmlEncodings.contains(actualEncoding));
    }
View Full Code Here

Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()

        super(staxImpl);
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(new ByteArrayInputStream(
                "<?xml version='1.0' encoding='iso-8859-15'?><root/>".getBytes("iso-8859-15")));
        assertEquals("iso-8859-15", reader.getEncoding());
        reader.next();
        try {
            reader.getEncoding();
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.