Package com.fasterxml.aalto

Examples of com.fasterxml.aalto.AsyncXMLInputFactory


    }

    public void testStandAloneDeclaration2() throws Exception
    {
        String XML = "<?xml version=\"1.0\" standalone='yes'?>\n<root/>";
        AsyncXMLInputFactory f = new InputFactoryImpl();

        for (int chunkSize : CHUNK_SIZES) {
            AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
            AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, XML);
            assertEquals(EVENT_INCOMPLETE, reader.currentToken());
            assertTokenType(START_DOCUMENT, reader.nextToken());
            assertEquals("UTF-8", sr.getEncoding());
            assertNull(sr.getCharacterEncodingScheme());
View Full Code Here


    private void _testEntity(int chunkSize, boolean checkValues, String spaces) throws Exception
    {
        final String XML = spaces + "<root>&entity1;Some text&entity2;!<leaf>...&leafEntity;</leaf>&last;</root>";
       
        AsyncXMLInputFactory f = new InputFactoryImpl();
        // important must not require expansion of general entities
        f.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, XML);

        // should start with START_DOCUMENT, but for now skip
        int t = verifyStart(reader);
        assertTokenType(START_ELEMENT, t);
View Full Code Here

    private final static String XML = "<?p    i ?><root><?pi \nwith\r\ndata??><?x \nfoo> "+UNICODE_SEGMENT+" bar? ?></root><?proc    \r?>";
   
    private void _testPI(String spaces, int chunkSize) throws Exception
    {
        AsyncXMLInputFactory f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, spaces+XML);
        int t = verifyStart(reader);
        assertTokenType(PROCESSING_INSTRUCTION, t);
        assertEquals("p", sr.getPITarget());
        assertEquals("i ", sr.getPIData());
View Full Code Here

        assertTokenType(END_DOCUMENT, reader.nextToken());
    }

    private void _testPISkip(String spaces, int chunkSize) throws Exception
    {
        AsyncXMLInputFactory f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, spaces+XML);
        int t = verifyStart(reader);
        assertTokenType(PROCESSING_INSTRUCTION, t);
        assertTokenType(START_ELEMENT, reader.nextToken());
        assertTokenType(PROCESSING_INSTRUCTION, reader.nextToken());
View Full Code Here

    /**********************************************************************
     */
   
    private void _testLinefeeds(int chunkSize, boolean checkValues, String SPC) throws Exception
    {
        AsyncXMLInputFactory f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
        final String XML = SPC+"<root>\rFirst\r\nSecond\nThird: "+UNICODE_SEGMENT+"</root>";
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, XML);

        assertTokenType(START_ELEMENT, verifyStart(reader));
        if (checkValues) {
View Full Code Here

        assertFalse(sr.hasNext());
    }

    private void _testTextWithEntities(int chunkSize, boolean checkValues, String SPC) throws Exception
    {
        AsyncXMLInputFactory f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
        final String XML = SPC+"<root>a&lt;b\rMOT</root>";
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, XML);

        // should start with START_DOCUMENT, but for now skip
        int t = verifyStart(reader);
View Full Code Here

        assertFalse(sr.hasNext());
    }

    private void _testTextWithNumericEntities(int chunkSize, boolean checkValues, String SPC) throws Exception
    {
        AsyncXMLInputFactory f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
        final String XML = SPC+"<root>&#60;tag&#x3e;!</root>";
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, XML);

        // should start with START_DOCUMENT, but for now skip
        int t = verifyStart(reader);
View Full Code Here

    private final static String XML = "<root><![CDATA[cdata\r\n&] ]] stuff]]>...<![CDATA[this\r\r and Unicode: "+UNICODE_SEGMENT+"!]]></root>";
   
    private void _testCData(int chunkSize, String SPC) throws Exception
    {
        AsyncXMLInputFactory f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, SPC + XML);

        int t = verifyStart(reader);
        assertTokenType(START_ELEMENT, t);
        assertEquals("root", sr.getLocalName());
View Full Code Here

        assertFalse(sr.hasNext());
    }

    private void _testCDataSkip(int chunkSize, String SPC) throws Exception
    {
        AsyncXMLInputFactory f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, SPC + XML);

        int t = verifyStart(reader);
        assertTokenType(START_ELEMENT, t);
        assertEquals("root", sr.getLocalName());
View Full Code Here

    /**********************************************************************
     */

    private void _testEmptyRoot(int chunkSize, String XML) throws Exception
    {
        AsyncXMLInputFactory f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, XML);

        // should start with START_DOCUMENT, but for now skip
        int t = verifyStart(reader);
        assertTokenType(START_ELEMENT, t);
View Full Code Here

TOP

Related Classes of com.fasterxml.aalto.AsyncXMLInputFactory

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.