Get Element from an XML-String

I'm pretty new to java --
Is there a function that returns elements from an XML-string? (not from an XML-document).
It would be similar to getElementsByTagName, but it would take a String as input, instead of operating on a Document.
thanks.
-Joe P.
jpalumbosAsked:
Who is Participating?
 
objectsCommented:
Following example shows how to create DOM tree from XML string:

http://javaalmanac.com/egs/javax.xml.parsers/Str2Dom.htm

You can then access elements from that tree.

http://javaalmanac.com/egs/org.w3c.dom/pkg.html
0
 
CEHJCommented:
Use an InputSource

builder.parse(new InputSource(new StringReader(yourString)));
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.