Once you have the document in memory and have a handle on an element, you should be able to call its setTextContent method, just like I have used getTextContent here.
Hi Paul , what if I've XML string rather then XML File. how do I parse it and store into Maps? for Ex:String vehicleInfo = " BMW Yamaha GMC " need to store the tag name as a Key and tag value as a Value into the map. Thanks in advance.
You could turn the string into a stream and hand that to the XML parser, then either walk the DOM or handle the SAX events to build your map. ByteArrayInputStream is part of the standard library, but you can find even more alternatives on StackOverflow. That's probably the best place for this kind of question, really.
How to handle nested xml like I have 5 reports each have 10 tags and out of 10tags have 3-4 subtags. Eg. 12345 .... Same as Rep 1 I have total 5 Rep tags
The same principles hold. Walk through the tree one step at a time, casting the results into the right types to get the API calls you need. One useful technique for exploring the API is to use the integrated debugger. You can set a breakpoint then try different API calls while the application is paused, allowing you to figure out what combination of calls gets to the data you seek.
Hi, I have to convert xml files 3.01 version and into another 2.2.5 versision xml file. Is it possible in java to make a tool for version conversion???? Thank's a lot sd.waseem
Amazing tutorial man, very in-depth and very clear
thanks a lot.
You're welcome!
Wow! You know your stuff!
It's a living :)
Hi Paul, what if I want to get all the title from each tag?
it was helpful, thanks!
I want to write or replace the text of the text tag in the xml , can you explain how ?
Once you have the document in memory and have a handle on an element, you should be able to call its setTextContent method, just like I have used getTextContent here.
helpful! thanks mahn! :)
You're welcome!
Hi Paul , what if I've XML string rather then XML File. how do I parse it and store into Maps?
for Ex:String vehicleInfo = "
BMW
Yamaha
GMC
"
need to store the tag name as a Key and tag value as a Value into the map.
Thanks in advance.
You could turn the string into a stream and hand that to the XML parser, then either walk the DOM or handle the SAX events to build your map. ByteArrayInputStream is part of the standard library, but you can find even more alternatives on StackOverflow. That's probably the best place for this kind of question, really.
+Paul Gestwicki ,Thanks a lot Paul, really appreciate it.
How to handle nested xml like I have 5 reports each have 10 tags and out of 10tags have 3-4 subtags.
Eg.
12345
....
Same as Rep 1
I have total 5 Rep tags
The same principles hold. Walk through the tree one step at a time, casting the results into the right types to get the API calls you need. One useful technique for exploring the API is to use the integrated debugger. You can set a breakpoint then try different API calls while the application is paused, allowing you to figure out what combination of calls gets to the data you seek.
Hi,
I have to convert xml files 3.01 version and into another 2.2.5 versision xml file.
Is it possible in java to make a tool for version conversion????
Thank's a lot
sd.waseem
I'm sure it's possible: it's just structured data transformation. I can't say much more about it though.
Thanks for the quick reply.can You Plz give some reference fro that???
oh god why I am still using java?