Package com.fasterxml.aalto.stax

Examples of com.fasterxml.aalto.stax.InputFactoryImpl


    }

    public void testEncodingDeclaration() throws Exception
    {
        String XML = "<?xml version= \"1.0\"   encoding='UTF-8' ?><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());
            assertEquals("UTF-8", sr.getCharacterEncodingScheme());
View Full Code Here


    }

    public void testStandAloneDeclaration() throws Exception
    {
        String XML = "<?xml version  ='1.0' encoding=\"UTF-8\"  standalone='yes' ?>  <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());
            assertEquals("UTF-8", sr.getCharacterEncodingScheme());
View Full Code Here

    }

    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 _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

        assertFalse(sr.hasNext());
    }

    private void _testElements(int chunkSize, String SPC) throws Exception
    {
        AsyncXMLInputFactory f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
//        final String XML = SPC+"<root attr='1&amp;2'><leaf xmlns='abc' a   ='3'\rb=''  /></root>";
        final String XML = SPC+"<root attr='1&amp;2'><leaf xmlns='abc' a   ='3'\rxmlns:foo='bar'  b=''  /></root>";
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, XML);

        // should start with START_DOCUMENT, but for now skip
View Full Code Here

        assertFalse(sr.hasNext());
    }

    private void _testElementsWithAttrs(int chunkSize, boolean checkValues, String SPC) throws Exception
    {
        AsyncXMLInputFactory f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
//        final String XML = SPC+"<root attr='1&amp;2'><leaf xmlns='abc' a   ='3'\rb=''  /></root>";
        final String XML = SPC+"<root attr='1&#62;2, 2&#x3C;1' />";
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, XML);

        // should start with START_DOCUMENT, but for now skip
View Full Code Here

        assertFalse(sr.hasNext());
    }

    private void _testElementsWithUTF8Attrs(int chunkSize, boolean checkValues, String SPC) throws Exception
    {
        AsyncXMLInputFactory f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader();
        final String VALUE = "Gr\u00e4";
        final String XML = SPC+"<root attr='"+VALUE+"' />";
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, XML);

        // should start with START_DOCUMENT, but for now skip
View Full Code Here

    }
   
    private void _testElementsWithIllegalChars(int chunkSize, boolean checkValues, String SPC) throws Exception
    {
      char replaced = ' ';
      InputFactoryImpl f = new InputFactoryImpl();
        AsyncXMLStreamReader sr = f.createAsyncXMLStreamReader(new IllegalCharHandler.ReplacingIllegalCharHandler(replaced));
        char illegal = 22;
        final String VALUE = "Gr" + illegal;
        final String VALUE_REPL  = "Gr" + replaced;
        final String XML = SPC+"<root attr='"+VALUE+"' />";
        AsyncReaderWrapper reader = new AsyncReaderWrapper(sr, chunkSize, XML);
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

TOP

Related Classes of com.fasterxml.aalto.stax.InputFactoryImpl

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.