Note that there are some explanatory texts on larger screens.

plurals
  1. POTransforming XML so it can be read with DataSet.ReadXML
    text
    copied!<p>I have been given an XML document in a rather strange format and I need to load it into a DataSet, but unsurprisingly I get an error when I try to do so. I can see how I could transform the document into something that would work, but I'm kinda going around in circles with the XSLT stuff...</p> <p>The document looks something like this:</p> <pre>&lt;map&gt; &lt;entry key = "status"&gt;ok&lt;/entry&gt; &lt;entry key = "pageNum"&gt;1&lt;/entry&gt; &lt;entry key = "title"&gt;DocTitle&lt;/entry&gt; &lt;entry key = "stuff"&gt; &lt;map&gt; &lt;entry key = "id"&gt;171&lt;/entry&gt; &lt;entry key = "name"&gt;StackOverflow&lt;/entry&gt; &lt;entry key = "timeZone"&gt;America/New_York&lt;/entry&gt; &lt;/map&gt; &lt;map&gt; &lt;entry key = "id"&gt;172&lt;/entry&gt; &lt;entry key = "name"&gt;StackOverflow2&lt;/entry&gt; &lt;entry key = "timeZone"&gt;America/New_York&lt;/entry&gt; &lt;/map&gt; &lt;/entry&gt; &lt;/map&gt;</pre> <p>and I would like to transform it into something more like this:</p> <pre>&lt;map&gt; &lt;status&gt;ok&lt;/status&gt; &lt;pageNum&gt;1&lt;/pageNum&gt; &lt;title&gt;DocTitle&lt;/title&gt; &lt;stuff&gt; &lt;map&gt; &lt;id&gt;171&lt;/id&gt; &lt;name&gt;StackOverflow&lt;/name&gt; &lt;timeZone&gt;America/New_York&lt;/timeZone&gt; &lt;/map&gt; &lt;map&gt; &lt;id&gt;172&lt;/id&gt; &lt;name&gt;StackOverflow2&lt;/name&gt; &lt;timeZone&gt;America/New_York&lt;/timeZone&gt; &lt;/map&gt; &lt;/stuff&gt; &lt;/map&gt;</pre> <p>I have all the code in place to run it through an XSLT transform and process the output, but I can't get the transform itself to produce anything sensible. I really don't think it's as difficult as I'm making it, and I would be eternally grateful if some wise soul could throw together something that would work.</p> <p>Or maybe just point me to an example or something that I could modify...</p> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload