<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to parse a String to ivy xml-object?</title><link>https://answers.axonivy.com/questions/31/how-to-parse-a-string-to-ivy-xml-object</link><description>&lt;p&gt;I receive a string from an external java class which is an xml-file. How can I parse this to an ivy-xml object? (Xpert.ivy 4.3)&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/31/how-to-parse-a-string-to-ivy-xml-object" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 21 Oct 2013 08:29:02 -0400</lastBuildDate><item><title>Answer by Nikel Weis</title><link>https://answers.axonivy.com/questions/31/how-to-parse-a-string-to-ivy-xml-object/34</link><description>&lt;p&gt;If an XML-Object (not an ivy-scripting object) is fine for you - which works in my case - I used the following approach:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import java.io.StringReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;

[...]
String xmlString = geoCode.getXML();

DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder db;

db = dbfac.newDocumentBuilder();
Document xmlDoc = db.parse(new InputSource(new StringReader(xmlString)));
[...]
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nikel Weis</dc:creator><pubDate>Mon, 21 Oct 2013 08:29:02 -0400</pubDate><guid>https://answers.axonivy.com/questions/31/how-to-parse-a-string-to-ivy-xml-object/34</guid></item><item><title>Answer by Reto Weiss</title><link>https://answers.axonivy.com/questions/31/how-to-parse-a-string-to-ivy-xml-object/32</link><description>&lt;p&gt;The following ivyScript parses an xml stored in string to an ivy-xml object:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;String xmlDocument = "&amp;lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?&amp;gt; &amp;lt;role&amp;gt; &amp;lt;identifier&amp;gt;Everybody&amp;lt;/identifier&amp;gt; &amp;lt;/role&amp;gt;";
Xml xml = new Xml(xmlDocument);
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reto Weiss</dc:creator><pubDate>Fri, 18 Oct 2013 16:32:49 -0400</pubDate><guid>https://answers.axonivy.com/questions/31/how-to-parse-a-string-to-ivy-xml-object/32</guid></item></channel></rss>