Attributes and element names are case sensitive. Your example XML uses "id" not "ID".
var xl:XMLList=elementsList..(@id=="hello"); -Alex On 4/18/16, 1:03 PM, "mark goldin" <[email protected]> wrote: >Doing it like this: >XML.Books.(attribute("ID") == 298), returns no data. > >On Mon, Apr 18, 2016 at 2:02 PM mark goldin <[email protected]> wrote: > >> No such variable: @ID >> >> On Mon, Apr 18, 2016 at 2:00 PM mark goldin <[email protected]> >>wrote: >> >>> I am also trying this: >>> >>> var elementsList:XML=<nodes> >>> <node id="d"> >>> <node id="hello"/> >>> <node id="d1"> >>> <node id="hello"> >>> </node> >>> </node> >>> </node></nodes>; >>> >>> var xl:XMLList=elementsList..*.(@id=="hello"); >>> >>> I am getting an error: >>> >>> No such variable @id >>> >>> >>> On Mon, Apr 18, 2016 at 1:55 PM mark goldin <[email protected]> >>> wrote: >>> >>>> I am trying and it's not returning anything >>>> >>>> >>>> On Mon, Apr 18, 2016 at 1:40 PM mark goldin <[email protected]> >>>> wrote: >>>> >>>>> I was thinking about something like this: >>>>> _myListXML.Books.(attribute('ID') == '298') >>>>> >>>>> Which should give me: >>>>> <Books ID="298"> >>>>> <book/> >>>>> ..... >>>>> <Books/> >>>>> >>>>> That way I can get either all books as you are showing or just a >>>>>given >>>>> books id. >>>>> Is that possible? >>>>> >>>>> On Mon, Apr 18, 2016 at 12:50 PM Harbs <[email protected]> wrote: >>>>> >>>>>> var myXMLList:XMLList = myXml..Book; >>>>>> >>>>>> On Apr 18, 2016, at 7:50 PM, mark goldin <[email protected]> >>>>>> wrote: >>>>>> >>>>>> > var myXml:XML = >>>>>> > <parent> >>>>>> > <Books> >>>>>> > <Book name="something1" /> >>>>>> > <Books> >>>>>> > <Book name="something1" /> >>>>>> > <someotherelements/> >>>>>> > <Book name="something2" /> >>>>>> > <Book name="something3" /> >>>>>> > </Books> >>>>>> > <Book name="something2" /> >>>>>> > <Book name="something3" /> >>>>>> > <someotherelements/> >>>>>> > </Books> >>>>>> > <someotherelements/> >>>>>> > </parent>; >>>>>> > >>>>>> > My point is that <Book> element can be at any level and as deep. >>>>>>And >>>>>> it is >>>>>> > an element. >>>>>> > >>>>>> > On Mon, Apr 18, 2016 at 11:46 AM Alex Harui <[email protected]> >>>>>> wrote: >>>>>> > >>>>>> >> Show some example XML. It matters if Book is an element or >>>>>> attribute. >>>>>> >> >>>>>> >> -Alex >>>>>> >> >>>>>> >> On 4/18/16, 9:36 AM, "mark goldin" <[email protected]> wrote: >>>>>> >> >>>>>> >>> No, not exactly. I want to say: for all elements that have a >>>>>>name >>>>>> 'Book' >>>>>> >>> at >>>>>> >>> any level give me its someproperty value. >>>>>> >>> >>>>>> >>> On Mon, Apr 18, 2016 at 11:32 AM Kessler CTR Mark J < >>>>>> >>> [email protected]> wrote: >>>>>> >>> >>>>>> >>>> You mean like using dot notation and walking down the nodes or >>>>>> >>>> filtering? >>>>>> >>>> I use somethings similar with some e4x / xmllistcollections. I >>>>>> just >>>>>> >>>> typed >>>>>> >>>> this off the top of my head so it might need to be checked. >>>>>> >>>> >>>>>> >>>> >>>>>> >>>> var myXml:XML = >>>>>> >>>> <parent> >>>>>> >>>> <Books> >>>>>> >>>> <Book name="something1" /> >>>>>> >>>> <Book name="something2" /> >>>>>> >>>> <Book name="something3" /> >>>>>> >>>> </Books> >>>>>> >>>> <Magazines> >>>>>> >>>> <Magazine someproperty="item1" /> >>>>>> >>>> <Magazine someproperty="item1" /> >>>>>> >>>> <Magazine someproperty="item2" /> >>>>>> >>>> <Magazine someproperty="item2" /> >>>>>> >>>> </Magazines> >>>>>> >>>> </parent>; >>>>>> >>>> >>>>>> >>>> >>>>>> >>>> List of books: >>>>>> >>>> myXml.Books.Book; >>>>>> >>>> >>>>>> >>>> List of magazines: >>>>>> >>>> myXml.Magazines.Magazine; >>>>>> >>>> >>>>>> >>>> Match specific items (returns 2 item1 rows): >>>>>> >>>> myXml.Magazines.Magazine.(@ someproperty == "item1"); >>>>>> >>>> >>>>>> >>>> >>>>>> >>>> -Mark >>>>>> >>>> >>>>>> >>>> >>>>>> >>>> -----Original Message----- >>>>>> >>>> From: mark goldin [mailto:[email protected]] >>>>>> >>>> Sent: Monday, April 18, 2016 12:02 PM >>>>>> >>>> To: users >>>>>> >>>> Subject: [Non-DoD Source] Filtering XML doc >>>>>> >>>> >>>>>> >>>> I have a nested XML and I want to select only these elements >>>>>>from >>>>>> it >>>>>> >>>> that >>>>>> >>>> have a specific name at any level. >>>>>> >>>> How can I do that? >>>>>> >>>> >>>>>> >>>> Thanks >>>>>> >>>> >>>>>> >> >>>>>> >> >>>>>> >>>>>>
