• Post Reply Bookmark Topic Watch Topic
  • New Topic

So how do I start parsing XML with URLConnection?  RSS feed

 
Patrick Ma
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using a URLConnection to open a XML document via the web and using authentication cookies, how can I begin parsing the retrieved XML document?



I don't really know if this works or not, but I do know I have no idea how to cycle through the nodes of the document.
Coming from the Ruby world, I would like to use a XML parser that has functionality similar to Ruby's Nokogiri.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your code succeeds at building a Document, thats all you can expect from a parser.

For examining the DOM, why simply use the standard library methods. I would start by careful study of the org.w3c.dom.Node documentation. Pay particular attention to the table in the JavaDocs that show how the various kinds of Nodes behave.

Bill
 
dileep keely
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to go for just reading the XML content then go for SAX which is an event-based driven.
else go for DOM read-write-create XML.

 
Rudy Gireyev
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been using the Xerces parser for many years now.
 
Paul Clapham
Sheriff
Posts: 22205
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't know how to navigate around the DOM? Here's a tutorial: http://java.sun.com/webservices/reference/tutorials/jaxp/html/dom.html.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!