Package javax.xml.stream

Examples of javax.xml.stream.XMLEventReader


        } catch (XMLStreamException ex) {
           
        }

        ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());       
        XMLEventReader evtReader = null;
        try {           
            evtReader = inputFactory.createXMLEventReader(inStream);
            // read the first tag which should be a start document
            XMLEvent evt = evtReader.nextEvent();
            assertTrue(evt.isStartDocument());
        } catch (XMLStreamException ex) {
        }
        assertNotNull(evtReader);
       
View Full Code Here


            evtWriter.flush();
        } catch (XMLStreamException ex) {
           
        }
        ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());       
        XMLEventReader evtReader = null;
        try {           
            evtReader = inputFactory.createXMLEventReader(inStream);
            // read the first tag which should be a start document
            XMLEvent evt = evtReader.nextEvent();
            assertTrue(evt.isStartDocument());
        } catch (XMLStreamException ex) {
        }
        assertNotNull(evtReader);
       
View Full Code Here

        } catch (XMLStreamException ex) {
           
        }

        ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());       
        XMLEventReader evtReader = null;
        try {           
            evtReader = inputFactory.createXMLEventReader(inStream);
            // read the first tag which should be a start document
            XMLEvent evt = evtReader.nextEvent();
            assertTrue(evt.isStartDocument());
        } catch (XMLStreamException ex) {
        }
        assertNotNull(evtReader);
       
View Full Code Here

        } catch (XMLStreamException ex) {
           
        }

        ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());       
        XMLEventReader evtReader = null;
        try {           
            evtReader = inputFactory.createXMLEventReader(inStream);
            // read the first tag which should be a start document
            XMLEvent evt = evtReader.nextEvent();
            assertTrue(evt.isStartDocument());
        } catch (XMLStreamException ex) {
        }
        assertNotNull(evtReader);
       
View Full Code Here

            String link = "";
            // First create a new XMLInputFactory
            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
            // Setup a new eventReader
            InputStream in = read();
            XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
            // Read the XML document
            while (eventReader.hasNext())
            {
                XMLEvent event = eventReader.nextEvent();
                if (event.isStartElement())
                {
                    if (event.asStartElement().getName().getLocalPart().equals(TITLE))
                    {                 
                        event = eventReader.nextEvent();
                        title = event.asCharacters().getData();
                        continue;
                    }
                    if (event.asStartElement().getName().getLocalPart().equals(LINK))
                    {                 
                        event = eventReader.nextEvent();
                        link = event.asCharacters().getData();
                        continue;
                    }
                }
                else if (event.isEndElement())
View Full Code Here

    String freq = "";
    int counter = 0;
    try {
      XMLInputFactory inputFactory = XMLInputFactory.newInstance();
      InputStream in = new FileInputStream(sdmxFilePath);
      XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
     
      while (eventReader.hasNext())
      {
        XMLEvent event = eventReader.nextEvent();
        if (event.isStartElement())
        {
          StartElement startElement = event.asStartElement();
          // if the element is starting with <data:Series
          if (startElement.getName().getLocalPart() == "Series")
View Full Code Here

    }

    @Test
    public void testStaxSourceEventReader() throws Exception {
        XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        XMLEventReader eventReader = inputFactory.createXMLEventReader(new StringReader(REQUEST));
        testSource(new SAXSource(StaxUtils.createXMLReader(eventReader), new InputSource()));
    }
View Full Code Here

    @Test
    public void testGetQNameForStaxSourceEventReader() throws Exception {
        String contents = "<prefix:localname xmlns:prefix='namespace'/>";
        XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        XMLEventReader eventReader = inputFactory.createXMLEventReader(new StringReader(contents));
        Source source = StaxUtils.createStaxSource(eventReader);
        QName qName = PayloadRootUtils.getPayloadRootQName(source, TransformerFactory.newInstance());
        Assert.assertNotNull("getQNameForNode returns null", qName);
        Assert.assertEquals("QName has invalid localname", "localname", qName.getLocalPart());
        Assert.assertEquals("Qname has invalid namespace", "namespace", qName.getNamespaceURI());
View Full Code Here

    private XMLStreamReader resolveStreamReader(Source requestSource) throws TransformerException, XMLStreamException {
        XMLStreamReader streamReader = null;
        if (StaxUtils.isStaxSource(requestSource)) {
            streamReader = StaxUtils.getXMLStreamReader(requestSource);
            if (streamReader == null) {
                XMLEventReader eventReader = StaxUtils.getXMLEventReader(requestSource);
                if (eventReader != null) {
                    try {
                        streamReader = StaxUtils.createEventStreamReader(eventReader);
                    }
                    catch (XMLStreamException ex) {
View Full Code Here

        }
        return streamReader;
    }

    private XMLEventReader resolveEventReader(Source requestSource) throws TransformerException, XMLStreamException {
        XMLEventReader eventReader = null;
        if (StaxUtils.isStaxSource(requestSource)) {
            eventReader = StaxUtils.getXMLEventReader(requestSource);
            if (eventReader == null) {
                XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(requestSource);
                if (streamReader != null) {
View Full Code Here

TOP

Related Classes of javax.xml.stream.XMLEventReader

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.