POLITECHNIKA RZESZOWSKA - Wydział Elektrotechniki I Informatyki
$-—----
■ XMLEventReader
XMLInputFactory factory = XMLInputFactory.newInstance(); try {
XMLEventReader eventReader =
factory.oreataXMLEventReader(new FileInputStream("test.xml")); while(eventReader.hasNext()) {
XMLEvent event = eventReader.nextEvent();
if(event.getEventType() = XMLStreamConstants.STARTELEMENT){ StartElement startElement = event.asStartElement();
System.out.println(startElement.getName().getLocalPart());
>
//handle morę event types here...
}
} catch (XMLStreamException e) { e.printStackTrace();
JAVA Wykład.
Copyright © 2012 Jan PROKOP