Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The node is picked up by the <code>children()</code> method just the way you intended, because otherwise the <code>length()</code> of <code>children()</code> would be 0. What you have to understand is that <code>trace( node.children());</code> actually means <code>trace ( XMLList( node.children() ).toString());</code> - you are calling toString() on an XMLList - the output of which can have a number of different results, though obviously not very predictable ones:</p> <pre><code>var xml : XML = &lt;node&gt;&lt;child&gt;MyText&lt;/child&gt;&lt;/node&gt;; trace ( xml.children () ); // =&gt; MyText xml = &lt;node&gt;&lt;child value="MyText" /&gt;&lt;/node&gt;; trace ( xml.children () ); // =&gt; nothing xml = &lt;node&gt;&lt;child key="myKey" id="1" value="MyText" /&gt;&lt;/node&gt;; trace ( xml.children () ); // =&gt; nothing xml = &lt;node&gt;&lt;child id="1" key="text"&gt;MyText&lt;/child&gt;&lt;/node&gt;; trace ( xml.children () ); // =&gt; MyText xml = &lt;node&gt;&lt;child id="1"&gt;MyText&lt;child id="2"&gt;MyOtherText&lt;/child&gt;&lt;/child&gt;&lt;/node&gt;; trace ( xml.children () ); // =&gt; &lt;child id="1"&gt;MyText&lt;child id="2"&gt;MyOtherText&lt;/child&gt;&lt;/child&gt; </code></pre> <p>To make sure you get the full xml of your child node, try:</p> <pre><code>var childXML : String = node.children().length() &gt; 0 ? node.children()[0].toXMLString():"empty"); trace("node.child#0:"+ childXML); // output: // node.child#0:&lt;Requirement ID="REQ-BUS-3.2.1" title="exigence bus3" description="blabla 321" testable="true"/&gt; </code></pre>
 

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