troubleshooting Question

E4X Filtering XML

Avatar of marcparillo
marcparillo asked on
Adobe FlashXML
2 Comments1 Solution296 ViewsLast Modified:

I'm having the hardest time trying to figure out how to extract a particular node from an XML file using E4X filtering in Flash/Actionscript.

All I know is the <truck> id and I need to get the entire <plot> parent node based on that id.

For example:

var xmlList:XMLList = xml..plot.(trucks.truck.(id==The_id_I_Want));

So, if I need the plot for the truck whose id is 26, I would get the following xml snippet:

<plot woeid="2347584" location="Missouri">
  <latitude>38.2588940</latitude>
  <longitude>-92.4365880</longitude>
  <trucks>
    <truck>
      <id>26</id>
      <title><![CDATA[Main Truck]]></title>
      <operators>
        <permanent><![CDATA[JK Smith]]></permanent>
      </operators>
    </truck>
  </trucks>
</plot>

Thanks,
marc
<?xml version='1.0' encoding='utf-8'?>
<root>
<header><source>trucks</source>
</header>
<plotList>
<plot woeid="2512025" location="Vicksburg">
  <latitude>32.3500400</latitude>
  <longitude>-90.8815540</longitude>
  <trucks>
    <truck>
      <id>23</id>
      <title><![CDATA[Blizzard]]></title>
      <operators>
        <current><![CDATA[Mike Smith]]></current>
      </operators>
    </truck>
  </trucks>
</plot>
<plot woeid="2347584" location="Missouri">
  <latitude>38.2588940</latitude>
  <longitude>-92.4365880</longitude>
  <trucks>
    <truck>
      <id>26</id>
      <title><![CDATA[Main Truck]]></title>
      <operators>
        <permanent><![CDATA[JK Smith]]></permanent>
      </operators>
    </truck>
  </trucks>
</plot>
<plot woeid="2359991" location="Baton Rouge">
  <latitude>30.4433350</latitude>
  <longitude>-91.1869940</longitude>
  <trucks>
    <truck>
      <id>10</id>
      <title><![CDATA[Cowboy]]></title>
      <operators>
        <current><![CDATA[Mark Smith]]></current>
        <current><![CDATA[Mike Smith]]></current>
      </operators>
    </truck>
  </trucks>
</plot>
</plotList>

Open in new window

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros