Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try putting the HTML addition code</p> <pre><code> htmlstring += "&lt;" + type + " id=" + id + " value=" + name + "/&gt;" + name + "&lt;/" + type + "&gt;"; </code></pre> <p>into the <code>while</code> loop. This way it will append for every tag, rather than just once after reading all tags.</p> <hr> <p><strong>EDIT</strong>: It's slightly more complex, sorry. Change your XML like so:</p> <pre><code>&lt;Groups&gt; &lt;Group&gt; &lt;Item&gt; &lt;Type&gt;Button&lt;/Type&gt; &lt;GUID&gt;124342345&lt;/GUID&gt; &lt;Title&gt;Name&lt;/Title&gt; &lt;/Item&gt; &lt;/Group&gt; &lt;Group&gt; &lt;Item&gt; &lt;Type&gt;textarea&lt;/Type&gt; &lt;GUID&gt;1243dsfs42345&lt;/GUID&gt; &lt;Title&gt;Name&lt;/Title&gt; &lt;/Item&gt; &lt;/Group&gt; &lt;/Groups&gt; </code></pre> <p>Then load it, create a new line for each <code>Item</code> tag. I've used the <code>XElement</code> parser rather than <code>XmlTextReader</code> for ease of use.</p> <pre><code>var reader = XElement.Load(xmlfileaddress); foreach (var item in reader.Descendants("Item")) { var id = item.Element("GUID").Value; var name = item.Element("Title").Value; var type = item.Element("Type").Value; htmlstring += "&lt;" + type + " id=" + id + " value=" + name + "/&gt;" + name + "&lt;/" + type + "&gt;"; } </code></pre> <p>This will get all your <code>&lt;Item&gt;</code> tags, read their 3 properties, and create a new line for them. If you plan on creating large documents this way, it's advisable to replace your <code>string htmlstring;</code> with a <a href="http://msdn.microsoft.com/en-us/library/system.text.stringbuilder.aspx" rel="nofollow"><code>StringBuilder</code></a>, for performance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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