Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I assume you're using a DOM parser.</p> <p>The first child of the <code>&lt;textlist&gt;</code> node is not the first <code>&lt;text&gt;</code> node but rather the raw text that contains the whitespace and carriage return between the end of <code>&lt;textlist&gt;</code> and the beginning of <code>&lt;text&gt;</code>. The output of the following snippet (using org.w3c.dom.* and javax.xml.parsers.*)</p> <pre><code>Node grandpa = document.getElementsByTagName("textlist").item(0); Node daddy = grandpa.getFirstChild(); while (daddy != null) { System.out.println("&gt;&gt;&gt; " + daddy.getNodeName()); Node child = daddy.getFirstChild(); if (child != null) System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; " + child.getTextContent()); daddy = daddy.getNextSibling(); } </code></pre> <p>shows that <code>&lt;textlist&gt;</code> has five children: the two <code>&lt;text&gt;</code> elements and the three raw text pieces before, between and after them.</p> <pre><code>&gt;&gt;&gt; #text &gt;&gt;&gt; text &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; Lore1 &gt;&gt;&gt; #text &gt;&gt;&gt; text &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; Lore2 &gt;&gt;&gt; #text </code></pre> <p>When parsing XML this way, it's easy to overlook that the structure of the DOM-tree can be complicated. You can quickly end up iterating over a NodeList in the wrong generation, and then you get nulls where you would expect siblings. This is one of the reasons why people came up with all kinds of xml-to-java stuff, from homegrown XMLHelper classes to XPath expressions to Digester to JAXB, so you need to go down to the DOM level only when you absolutely have to.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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