accessing node value rather than attribute

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default accessing node value rather than attribute

    Hello Guys,

    I have some XML that looks like this:

    <search>
    <arrivals>
    <option value="ADL">Adelaide</option>
    </arrivals>
    </search>

    When i use it with a comboBox as so:

    <mx:ComboBox id="arrivalCityCombo" dataProvider="{searchXML.arrivals.option}"/>

    I get the reverse of what I want as in - the display of the drop down is ADL
    and whan I try to get the value by doing:

    <mx:Model id="newModel"> <airport>{arrivalCityCombo.selectedItem}</airport>

    I get Adelaide.??

    Anyway to access the value rather than the content.

    I know that scemantically it makes more sense to have the value in the node
    but just wanted to know..

    Thanks

    twoei22 Guest

  2. Similar Questions and Discussions

    1. XML node inserting
      Hi is it possible use the function insertChildAfter() (or another useful function) to insert a node under the root node? For example, suppose...
    2. Accessing attribute in XML for HTTPService
      How can I access an attribute in a tag which is being used as a DataProvider for a DataGrid? <root> <item> <option1 id="123">Some...
    3. Retrive data from attribute spaced attribute.
      Hi. I'm retrieving data from an excel sheet. But one of the attributes is name "Phone private". This is a problem when I want to write out the...
    4. Retrieving XML attribute using XML::XPath::Node::Attribute
      Hi I am trying to retrieve an attribute of a particular node from my XML using "XML::XPath::Node::Attribute", but couldn't come across on how to...
    5. xpath - how to find a node where a specific attribute does NOT exist?
      Hi, since there doesn't appear to be a way to get the individual elements that make up the xpath to a result node, I'm trying to create an xpath...
  3. #2

    Default Re: accessing node value rather than attribute

    Use a labelFunction:

    <mx:ComboBox ... labelFunction="lblFnArrival" ...

    private function lblFnArrival(oItem:Object):String{
    return oItem.nodeValue;
    }

    ntsiii Guest

  4. #3

    Default Re: accessing node value rather than attribute

    You might have to get the text node of the item:
    return oItem.firstChild.nodeValue;
    ntsiii Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139