Skip to content

Instantly share code, notes, and snippets.

@yamanyar
Created April 7, 2012 05:38
Show Gist options
  • Save yamanyar/2325578 to your computer and use it in GitHub Desktop.
Save yamanyar/2325578 to your computer and use it in GitHub Desktop.
Cursor Example
URL u = new URL("http://www.cafeconleche.org/");
InputStream in = u.openStream();
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader parser = factory.createXMLStreamReader(in);
while (true) {
int event = parser.next();
if (event == XMLStreamConstants.END_DOCUMENT) {
parser.close();
break;
}
if (event == XMLStreamConstants.START_ELEMENT) {
System.out.println(parser.getLocalName());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment