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 4111996
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:08:16+00:00 2026-05-20T22:08:16+00:00

I have the following xml: <objects> <property name=steps> <property name=array> <object type=com.tn.assistant.models.Step> <property name=preDialogues>

  • 0

I have the following xml:

<objects>
    <property name="steps">
      <property name="array">
        <object type="com.tn.assistant.models.Step">
          <property name="preDialogues">
            <property name="array">
              <object type="com.tn.assistant.models.Dialogue"/>
            </property>
          </property>
          <property name="question">
            <object type="com.tn.assistant.models.Question">
            </object>
          </property>
        </object>
      </property>
    </property>
 </objects>

I am displaying this with a tree in a Flex 4 / air app. I need to filter out “steps”, any “array” nodes, and “preDialogues”. They should not show up in the tree, but their children should. I extended DefaultDataDescriptor, and overrode getChildren(), to successfully filter steps and array tags.

override public function getChildren(node:Object, model:Object=null):ICollectionView
{
    var ch:XMLList = new XMLList (node.xns::*);
    var retXMLList:XMLList = new XMLList();
    var retXMLListCtr = 0;
    for (var i = 0; i < ch.length(); i++){
        if (ch[i].@name == "array"){
            return getChildren(ch[i]);
        }

        else if (ch[i].@name == "steps"){
            return getChildren(ch[i]);
        }
/*
        else if (ch[i].@name == "preDialogues"){
            return getChildren(ch[i]);
        }
*/
        else {
            retXMLList[retXMLListCtr] = ch[i];
            retXMLListCtr++;
        }
    }
    var chil:XMLListCollection = new XMLListCollection (retXMLList);
    var chil2:ICollectionView = ICollectionView(chil);
    return chil2;
}

This code filters out “steps” and “array” successfully. However, if I uncomment the “preDialogues” code to try and filter out preDialogues, the question node gets skipped entirely. I can see why this happens, but what can I do about it? Its been awhile since I’ve done recursion. I thought I could return some sort of combined list, or something, but I can’t get anything to work. Thanks.

  • 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-20T22:08:17+00:00Added an answer on May 20, 2026 at 10:08 pm

    It’s getting skipped because you’re at the level of the “com.tn.assistant.models.Step” node. When you’re iterating over the children of that node, in this case “preDialogues” and “question”, the first one you come to you simply return it’s children (in this case, preDialogues’ children). It’s never even getting to the point where it checks “question”.

    It seems like you’d want something more like:

    override public function getChildren(node:Object, model:Object=null):ICollectionView
    {
        var ch:XMLList = new XMLList (node.xns::*);
        var retXMLList:XMLList = new XMLList();
        var retXMLListCtr = 0;
        for (var i = 0; i < ch.length(); i++){
            var name:String = String(ch[i].@name);
            if (name == "array" ||
                name == "steps" ||
                name == "preDialogues" ||
                name == "question") {
                retXMLList[retXMLListCtr] = getChildren(ch[i]);
            } else {
                retXMLList[retXMLListCtr] = ch[i];
            }
            retXMLListCtr++;
        }
        var chil:XMLListCollection = new XMLListCollection (retXMLList);
        var chil2:ICollectionView = ICollectionView(chil);
        return chil2;
    }
    

    It still iterates over each child, but when it gets to an “array” node, it adds its children to the retXMLList and continues iterating, rather than simply returning.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following XML array: [link]=> array(2) { [0]=> object(SimpleXMLElement)#311 (1) { [@attributes]=>
I have following code: //preparing DAO objects FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext(test-context.xml); surveyDao =
I have following object structure, deseralized from XML (WS): <ns2:Category> <ns2:CategoryId>800003</ns2:CategoryId> <ns2:CategoryName>Name1</ns2:CategoryName> <ns2:Categories> <ns2:Category>
Learning xml, Can anyone help me? I have following XML code: **<book lang=en>name of
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 some XML in the following format: <ObjectData> <ModelName>MODEL_123</ModelName> <ObjectName>OBJECT_A</ObjectName> <Values> <KeyValuePair> <Key>NAME</Key>
I have to create object model for following XMLs: XML sample 1: <InvoiceAdd> <TxnDate>2009-01-21</TxnDate>
I have following xml file: <ab> <![CDATA[ <table> <tbody> <tr> <th>abcdef</th> </tr> <tr> <p>
I have following xml as a response to a service not i want to
I have the following xml: <root> <text><![CDATA[ОПЕЛХМЮБЮ ОПЕГ БЗПРЪЫ ЯЕ АЮПЮАЮМ, Б ЙНИРН ЯЕ]]></text>

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.