Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Presumably it's all valid until it's truncated... so using <code>XmlReader</code> could work... just be prepared to handle it going bang when it reaches the truncation point.</p> <p>Now the <code>XmlReader</code> API isn't terribly pleasant (IMO) so you might want to move to the start of some interesting data (which would have to be complete in itself) and then call the <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.xnode.readfrom.aspx" rel="nofollow"><code>XNode.ReadFrom(XmlReader)</code></a> method to get that data in a simple-to-use form. Then move to the start of the next element and do the same, etc.</p> <p>Sample code:</p> <pre><code>using System; using System.Linq; using System.Xml; using System.Xml.Linq; class Program { static void Main(string[] args) { using (XmlReader reader = XmlReader.Create("test.xml")) { while (true) { while (reader.NodeType != XmlNodeType.Element || reader.LocalName != "Child") { if (!reader.Read()) { Console.WriteLine("Finished!"); } } XElement element = (XElement) XNode.ReadFrom(reader); Console.WriteLine("Got child: {0}", element.Value); } } } } </code></pre> <p>Sample XML:</p> <pre><code>&lt;Root&gt; &lt;Parent&gt; &lt;Child&gt;First child&lt;/Child&gt; &lt;Child&gt;Second child&lt;/Child&gt; &lt;Child&gt;Broken </code></pre> <p>Sample output:</p> <p>Got child: First child Got child: Second child</p> <pre><code>Unhandled Exception: System.Xml.XmlException: Unexpected end of file has occurred The following elements are not closed: Child, Parent, Root. Line 5, position 18. at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r) at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o) at System.Xml.Linq.XElement.ReadElementFrom(XmlReader r, LoadOptions o) at System.Xml.Linq.XNode.ReadFrom(XmlReader reader) at Program.Main(String[] args) </code></pre> <p>So obviously you'd want to catch the exception, but you can see that it managed to read the first two elements correctly.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    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