I have a String
content that comes from any soap XML
request.
I want to I identify a specific tag <FieldName>
having the value MyFieldIndicator
, and from there fetch the value of the next occuring <FieldValue>
.
How could I do this? Is there any library? Or which mechanisms could be used to extract those tags from a plain string?
Performance matters, so it should be as quick as possible.
the library dom4j is probably easiest to use and understand. You need to create a Document-Object from string and then access via iterators the tags. The documentation and examples can be fopund here
Generally u can probably use any DOM or SAX parser.
Other DOM parser : W3C, JDOM
SAX parser : JAXP
If u by any chance want to store the content into an object : try to learn JAXB
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.