| Author |
How to pasrse XML string quickly in java
|
srihari paturi
Greenhorn
Joined: Nov 25, 2007
Posts: 2
|
|
Hi all, Could you please tell me how to parse xml string in java. Ex. I have a string like this String str ="<A><b>10</b> <C><c>hai</c></C> </A> how to get the values of it? Thanks
|
 |
Freddy Wong
Ranch Hand
Joined: Sep 11, 2006
Posts: 959
|
|
You can use SAX or DOM for that. DOM is easier to use than SAX. You can also you dom4j, which is easier than the normal DOM. Do some google search. There are lot of tutorials on how to parse XML using DOM or SAX. Good luck.
|
SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
|
 |
Kamal Ahmed
Ranch Hand
Joined: Feb 15, 2005
Posts: 90
|
|
DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dFactory.newDocumentBuilder(); Document doc = dBuilder.parse(new InputSource(new StringReader("<test>test</test>")));
|
 |
 |
|
|
subject: How to pasrse XML string quickly in java
|
|
|