Package org.apache.xmlbeans.xml.stream

Examples of org.apache.xmlbeans.xml.stream.XMLInputStream


            reader1 = new StringReader(s);
            reader2 = new StringReader(s);

        System.out.println("reader ...");
        XmlStreamSource source = new XppXmlStreamImpl(reader1);
        XMLInputStream myStream = XmlStreamFactory.
                createXmlInputStream( source );

        XMLInputStream babelStream = XMLInputStreamFactory.newInstance().
            newInputStream(reader2);

        System.out.println("myStream ...");
        for(int i=0; myStream.hasNext() && i<3; i++)
        {
            System.out.println( "my: " + " '" +
                myStream.next() + "'");
            System.out.println( "bb: " + " '" +
                    babelStream.next() + "'");
        }

        XMLInputStream myss = myStream.getSubStream();
        XMLInputStream bbss = babelStream.getSubStream();

        for(int i=0; myss.hasNext() && i<3; i++)
        {
            System.out.println( "my SUBStream: " + " '" +
                    myss.next() + "'");
            System.out.println( "bb SUBStream: " + " '" +
                    bbss.next() + "'");
        }

        XMLInputStream myss2 = myss.getSubStream();
        XMLInputStream bbss2 = myss.getSubStream();
        for(; myss2.hasNext() ;)
        {
            System.out.println( "my SubSUBStream 2: " +
                    " '" + myss2.next() + "'");
            System.out.println( "bb SubSUBStream 2: " +
                    " '" + bbss2.next() + "'");
        }
        myss2.close();
        bbss2.close();

        for(; myss.hasNext() || bbss.hasNext() ;)
        {
            System.out.println( "my SUBStream: " + " '" +
                    myss.next() + "'");
View Full Code Here


        reader1 = new StringReader(s);
        reader2 = new StringReader(s);

        System.out.println("reader ... in main3");
        XmlStreamSource source = new XppXmlStreamImpl(reader1);
        XMLInputStream myStream = XmlStreamFactory.
                createXmlInputStream( source );

        //XMLInputStream babelStream = XMLInputStreamFactory.newInstance().
        //    newInputStream(reader2);

        System.out.println("myStream ...");
        for(int i=0; myStream.hasNext() && i<0; i++)
        {
            System.out.println( "my: " + " '" +
                myStream.next() + "'");
            //System.out.println( "bb: " + " '" +
            //        babelStream.next() + "'");
        }

        XMLInputStream myss = myStream.getSubStream();
        //XMLInputStream bbss = babelStream.getSubStream();

        for(int i=0; myss.hasNext() && i<3; i++)
        {
            System.out.println( "my SUBStream: " + " '" +
                    myss.next() + "'");
            //System.out.println( "bb SUBStream: " + " '" +
            //        bbss.next() + "'");
        }

        XMLInputStream myss2 = myss.getSubStream();
        //XMLInputStream bbss2 = myss.getSubStream();
        for(; myss2.hasNext() ;)
        {
            System.out.println( "my SubSUBStream 2: " +
                    " '" + myss2.next() + "'");
            //System.out.println( "bb SubSUBStream 2: " +
            //        " '" + bbss2.next() + "'");
        }
        myss2.close();
        //bbss2.close();

        for(; myss.hasNext() /*|| bbss.hasNext()*/ ;)
        {
            System.out.println( "my SUBStream: " + " '" +
View Full Code Here

            return;

        Reader r1 = new BufferedReader( new FileReader(file));
        Reader r2 = new BufferedReader( new FileReader(file));

        XMLInputStream xpp = XmlStreamFactory.
                createXmlInputStream(new XppXmlStreamImpl(r2));
        XMLInputStream babel = XMLInputStreamFactory.newInstance().
            newInputStream(r1);

        while( xpp.hasNext() || babel.hasNext() )
        {
            XMLEvent xppevent = xpp.peek();
            XMLEvent babelevent = babel.peek();

            if( !(""+xppevent).equals((""+babelevent)) )
                printError(xppevent, babelevent);
            else
            {
                //System.out.println("   `" + xppevent + "'\n   `" + babelevent +
                //                   "'"); System.out.flush();
            }

            xppevent = xpp.next();
            babelevent = babel.next();
        }

        //System.out.println("   xpp   overlimit: " + xpp.next() );
        //System.out.println("   babel overlimit: " + babel.next() );
View Full Code Here

            //throw new Exception("compareFile: file not a File");
            return;

        Reader r2 = new BufferedReader( new FileReader(file));

        XMLInputStream xpp = XmlStreamFactory.
                createXmlInputStream(new XppXmlStreamImpl(r2));
        XMLInputStream morphedStream;
        try
        {
            System.out.println("Starting xquery");
            XmlObject xmlObj = XmlObject.Factory.parse(xpp);
            XmlCursor crs = xmlObj.newCursor();
View Full Code Here

        //babel
        for( int i=0; i<TIMES; i++ )
        {
            Reader r = new BufferedReader( new FileReader(file));
            start = new Date().getTime();
            XMLInputStream babel = XMLInputStreamFactory.newInstance().
                newInputStream(r);
            while( babel.hasNext() )
            {
                XMLEvent babelevent = babel.peek();
                babelevent = babel.next();
            }
            babeltime += new Date().getTime() - start;
            r.close();
            //System.out.print(".");
        }

        //xpp with direct acces to the xpp parser
        for( int i=0; i<TIMES; i++ )
        {
            Reader r = new BufferedReader( new FileReader(file));
            start = new Date().getTime();
            MXParser xpp = (MXParser) new MXParserCachingStrings();
            xpp.setFeature( MXParser.FEATURE_PROCESS_NAMESPACES, true);
            xpp.setInput( r );
            int eventType = xpp.getEventType();
            while ( eventType != xpp.END_DOCUMENT )
            {
                eventType = xpp.nextToken();
            }
            xrtime += new Date().getTime() - start;
            r.close();
            //System.out.print("'");
        }

        //xpp with XppXmlStreamImpl
        for( int i=0; i<TIMES; i++ )
        {
            Reader r = new BufferedReader( new FileReader(file));
            //XMLInputStream xpp = new XppAdaptor().getStream(r2);
            start = new Date().getTime();
            XMLInputStream xpp = (XMLInputStream) new XppXmlStreamImpl(r);

            while( xpp.hasNext() )
            {
                XMLEvent xppevent = xpp.peek();
                xppevent = xpp.next();
            }
            xstime += new Date().getTime() - start;
            r.close();
            //System.out.print("`");
        }
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.xml.stream.XMLInputStream

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.