Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7545549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:57:34+00:00 2026-05-30T08:57:34+00:00

I have the following xml declaration: public var reqData:XML = <root> <Requirement ID=REQ-GEN-0.1 title=exigence

  • 0

I have the following xml declaration:

public var reqData:XML = <root>
  <Requirement ID="REQ-GEN-0.1" title="exigence gen 1" description="blabla 01" testable="true"/>
  <RequirementSet ID="GUI REQ">
    <Requirement ID="REQ-GUI-1.1" title="exigence ihm 1" description="blabla 11" testable="true"/>
    <Requirement ID="REQ-GUI-1.2" title="exigence ihm 2" description="blabla 12" testable="false"/>
  </RequirementSet>
  <RequirementSet ID="PERF REQ">
    <Requirement ID="REQ-PERF-2.1" title="exigence perf 1" description="blabla 21" testable="true"/>
    <Requirement ID="REQ-PERF-2.2" title="exigence perf 2" description="blabla 22" testable="false"/>
    <Requirement ID="REQ-PERF-2.3" title="exigence perf 3" description="blabla 23" testable="true"/>
    <Requirement ID="REQ-PERF-2.4" title="exigence perf 4" description="blabla 24" testable="false"/>
    <Requirement ID="REQ-PERF-2.5" title="exigence perf 5" description="blabla 25" testable="false"/>
    <Requirement ID="REQ-PERF-2.6" title="exigence perf 6" description="blabla 26" testable="false"/>
  </RequirementSet>
  <RequirementSet ID="BUS REQ">
    <RequirementSet ID="BUS 1 REQ">
      <Requirement ID="REQ-BUS-3.1.1" title="exigence bus 1" description="blabla 311" testable="false"/>
      <Requirement ID="REQ-BUS-3.1.2" title="exigence bus 2" description="blabla 312" testable="true"/>
    </RequirementSet>
    <RequirementSet ID="BUS 2 REQ">
      <Requirement ID="REQ-BUS-3.2.1" title="exigence bus3" description="blabla 321" testable="true"/>
    </RequirementSet>
    <RequirementSet ID="BUS 3 REQ"/>
  </RequirementSet>
</root>;

I populated an advanced datagrid with this xml but the problem is that a requirement isn’t detected: <Requirement ID="REQ-BUS-3.2.1" title="exigence bus3" description="blabla 321" testable="true"/>

I’ve overriden a method of the HierarchicalData class to see what happenned:

override public function canHaveChildren(node:Object):Boolean
        {
            if (node is XML && node != null){
                var xmlNode:XML = node as XML;
                trace("node:"+node);
                trace("node.children:"+node.children());
                trace("xmlNode.name:"+xmlNode.name());
                trace("xmlNode.localName:"+xmlNode.localName());
                trace("xmlNode.attributes:"+xmlNode.attributes());
                trace("xmlNode.attributes:"+xmlNode.nodeKind());
                trace("xmlNode.children():"+xmlNode.children());
                trace("xmlNode.children().length():"+xmlNode.children().length());

                if(xmlNode.children().length()>0){
                    var xmlNodeChildren:XMLList = xmlNode.children() as XMLList;
                    var xmlNodeFirstChild:XML = xmlNodeChildren[0];
                    trace("xmlNodeFirstChild:"+xmlNodeFirstChild);
                    trace("xmlNodeFirstChild.name():"+xmlNodeFirstChild.name());
                    trace("xmlNodeFirstChild.comments():"+xmlNodeFirstChild.comments());
                    trace("xmlNodeFirstChild.attributes():"+xmlNodeFirstChild.attributes());
                    trace("xmlNodeFirstChild.nodeKind():"+xmlNodeFirstChild.nodeKind());
                    trace("xmlNodeFirstChild.descendants():"+xmlNodeFirstChild.descendants());
                }


            } 

And here is the result (console), that I just don’t understand at all:

node:<RequirementSet ID="BUS 2 REQ">
  <Requirement ID="REQ-BUS-3.2.1" title="exigence bus3" description="blabla 321" testable="true"/>
</RequirementSet>
node.children:
xmlNode.name:RequirementSet
xmlNode.localName:RequirementSet
xmlNode.attributes:BUS 2 REQ
xmlNode.attributes:element
xmlNode.children():
xmlNode.children().length():1
xmlNodeFirstChild:
xmlNodeFirstChild.name():Requirement
xmlNodeFirstChild.comments():
xmlNodeFirstChild.attributes():REQ-BUS-3.2.1exigence bus3blabla 321true
xmlNodeFirstChild.nodeKind():element
xmlNodeFirstChild.descendants():

The node isn’t detected by the children() method but it exists. The problem is that I can’t look at the source code of XML.abc cause it isn’t open-source. Can someone tell me what is happenning? Is it a bug or something else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:57:35+00:00Added an answer on May 30, 2026 at 8:57 am

    The node is picked up by the children() method just the way you intended, because otherwise the length() of children() would be 0. What you have to understand is that trace( node.children()); actually means trace ( XMLList( node.children() ).toString()); – you are calling toString() on an XMLList – the output of which can have a number of different results, though obviously not very predictable ones:

    var xml : XML = <node><child>MyText</child></node>;
    trace ( xml.children () ); 
    // => MyText
    
    xml = <node><child value="MyText" /></node>;
    trace ( xml.children () ); 
    // => nothing
    
    xml = <node><child key="myKey" id="1" value="MyText" /></node>;
    trace ( xml.children () ); 
    // => nothing
    
    xml = <node><child id="1" key="text">MyText</child></node>;
    trace ( xml.children () ); 
    // => MyText
    
    xml = <node><child id="1">MyText<child id="2">MyOtherText</child></child></node>;
    trace ( xml.children () ); 
    // => <child id="1">MyText<child id="2">MyOtherText</child></child>
    

    To make sure you get the full xml of your child node, try:

    var childXML : String = node.children().length() > 0 ? node.children()[0].toXMLString():"empty");
    trace("node.child#0:"+ childXML);
    // output: 
    // node.child#0:<Requirement ID="REQ-BUS-3.2.1" title="exigence bus3" description="blabla 321" testable="true"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code public void SerializeToStream(Stream stream) { var xml = //
I have the following XML LINQ query from my XDocument. var totals = (from
I have created an XML document with the following contents. <books> <book id=1> <title>Title01</title>
I have the following XML structure: <?xml version=1.0 ?> <course xml:lang=nl> <body> <item id=787900813228567
I have the following xml I'd like to deserialize into a class <?xml version=1.0
I have the following XML document: <projects> <project> <name>Shockwave</name> <language>Ruby</language> <owner>Brian May</owner> <state>New</state> <startDate>31/10/2008
I have the following xml that's sent to me from a web service. I'm
I have the following XML <?xml version=1.0?> <FileHeader xmlns=urn:schemas-ncr-com:ECPIX:CXF:FileStructure:020001 VersionNumber=020001 TestFileIndicator=P CreationDate=13012009 CreationTime=172852 FileID=0000000001
I have the following XML: <XMLDictionary> <a>b</a> <c>d</c> <e>f</e> </XMLDictionary> I'm trying to get
I have the following XML source structure: <turnovers> <turnover repid=1 amount=500 rate=0.1/> <turnover repid=5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.