Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 437
  • Last Modified:

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.
0
jpalumbos
Asked:
jpalumbos
1 Solution
 
CEHJCommented:
Use an InputSource

builder.parse(new InputSource(new StringReader(yourString)));
0
 
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now