I'm looking into how I can get values from specific XML nodes in an XML file that I have. In my application, I have the entire XML file in a string, and I want to grab the specific information from there. I've heard a little bit about DOM and SAX, but I don't exactly know where to start. Any help?
Asked
Active
Viewed 1,222 times
3 Answers
0
You can either use XPath (example) or you can use DOM or SAX (as you mentioned) You can view my answer here (how to retrieve element value of XML using Java?) on SO.

Community
- 1
- 1

Buhake Sindi
- 87,898
- 29
- 167
- 228
0
Well, there is also Xstream http://x-stream.github.io/index.html
It let´s you do both directions (object to xml, and xml to object). Here is the "two minutes tutorial": http://x-stream.github.io/tutorial.html

facundofarias
- 2,973
- 28
- 27

raspayu
- 5,089
- 5
- 37
- 50
-
JAXB is the standard for mapping objects to XML, check out: http://bdoughan.blogspot.com/2010/10/how-does-jaxb-compare-to-xstream.html – bdoughan Nov 25 '10 at 13:19
-
Well, he just asked for getting the content of an xml without an xsd or anything in an easy way, and I find it easier with XStream. Just giving one more option ;-) – raspayu Nov 25 '10 at 13:49
-
JAXB does not require an XML schema, check out my blog for plenty of examples starting with POJOs: http://bdoughan.blogspot.com/ – bdoughan Nov 25 '10 at 15:07