XMLStreamReader: nextTag() : XMLStreamReader « javax.xml.stream « Java by API






XMLStreamReader: nextTag()

  


import java.io.File;
import java.io.FileInputStream;

import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    File file = new File("text.xml");

    XMLInputFactory inputFactory = XMLInputFactory.newInstance();
    XMLStreamReader reader = inputFactory.createXMLStreamReader(new FileInputStream(file));

    int eventTypeID = reader.nextTag();

    eventTypeID = reader.nextTag();

    eventTypeID = reader.next();
    System.out.println("Hello " + reader.getText());
  }
}

   
    
  








Related examples in the same category

1.XMLStreamReader.getLocalName()
2.XMLStreamReader: getElementText()
3.XMLStreamReader: getEventType()
4.XMLStreamReader: getLocation()
5.XMLStreamReader: getName()
6.XMLStreamReader: getText()
7.XMLStreamReader: hasNext()
8.XMLStreamReader: next()
9.XMLStreamReader: require(int type, String namespaceURI, String localName)