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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:30:29+00:00 2026-06-01T09:30:29+00:00

here is the xml data : <root> <recommendedMaterials> <value label=Aluminium data=0 /> <value label=Iron

  • 0

here is the xml data :

<root>
    <recommendedMaterials>
        <value label="Aluminium" data="0" /> 
        <value label="Iron" data="0" /> 
    </recommendedMaterials>

</root

My code :

<mx:Script>
        <![CDATA[
public function populateRecommendedMaterials(xml_val:XML)           
            {
                 materials_Cmb.dataProvider=(xml_val.recommendedMaterials); 
            }

    ]]>

</mx:Script>        

    <mx:ComboBox x="212" y="164" id="materials_Cmb" dataProvider="materialsCmb_Dp"></mx:ComboBox>

</mx:Canvas>

The problem is that the whole xml gets populated. I just want the labels. 🙁

  • 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-06-01T09:30:30+00:00Added an answer on June 1, 2026 at 9:30 am

    There are two approaches here, depending on what you need. In either case the data you want are the children of the recommendedMaterials node, not the node itself (which is what you did).

    materials_Cmb.dataProvider = 
        new XMLListCollection(xml_val.recommendedMaterials.children());
    

    This should already do the trick. Note that I wrapped the XMLList in an XMLListCollection: this is not strictly necessary with the mx:ComboBox, because it will do the same internally, but for Spark components it would be mandatory.

    Another more concise solution would be to just find all the ‘value’ nodes, but I don’t know whether that approach fits your bill.

    materials_Cmb.dataProvider = 
        new XMLListCollection(xml_val..value);
    

    Also don’t forget to assign the correct ‘labelField’ in the ComboBox:

    <s:ComboBox labelField="@label" />
    

    The @ sign represents an XML attribute.

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

Sidebar

Related Questions

Here is a simple form I am using to send XML data in admin_xml.php
I must transform some XML data into a paginated list of fields. Here is
i have used libxml2.Here when i am getting an XML data as a string
I have the following XML Parsing code in my application: public static XElement Parse(string
Here is the XML outline: <Root> <Thing att=11> <Child lang=e> <record></record> <record></record> <record></record> </Child
since i'm new to xml, i tried out the code over here , to
Here are the two ways for data structures i can think of with XML
I want to write a function that parses a (theoretically) unknown XML data structure
I am having trouble writing to my XML file Here is my code: path
Suppose I get the following XML structure: <root> <item> <item1>text1</item1> <item2>text2</item2> more text here

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.