Two things:

1. xml namespace:  The xml has namespace specified, so yo need to d:

default xml namespace =
"http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v1";;

 

2. I do not understand why the ".." did not work, but this does: 

var myXML2:XMLList = dataSet.descendants("Trackpoint");

 

Tracy

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Nate Pearson
Sent: Thursday, April 17, 2008 4:44 PM
To: [email protected]
Subject: [flexcoders] Re: Problems walking XML file with E4X

 

It's an air app but that shouldn't matter. If you download the file
bellow and put it in data/frankTT.xml you can try it too.

I was inspecting my XML through the debugger, but I think you want me
to do it this way.

Here it is:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
layout="absolute" creationComplete="onInit()">
<mx:XML id="dataSet" source="data/frankTT.xml" format="e4x" />
<mx:Script>
<![CDATA[

private function onInit():void{

var myXML2:XMLList = dataSet..Trackpoint
trace(myXML2.toXMLString());
}
]]>
</mx:Script>
<mx:Panel>

</mx:Panel>

</mx:WindowedApplication>

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> Just to be sure, you are using toXMLString() to inspect the xml,
> correct?
> 
> 
> 
> In fact, post the code where you are examining myXMLList.
> 
> 
> 
> Tracy
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Nate Pearson
> Sent: Thursday, April 17, 2008 4:19 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Re: Problems walking XML file with E4X
> 
> 
> 
> The trace shows all the data.
> 
> The other one doesn't work. I can see in the file that the case is
> "Trackpoint". Could it have to do with how it's nested?
> 
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> , "Tracy Spratt" <tspratt@> wrote:
> >
> > Skip this:
> > 
> > var myXML:XML = dataSet[0]; //dataSet is aleady XML
> > 
> > 
> > 
> > Do: 
> > 
> > trace(dataSet.toXMLString()); // USE toXMLString() always with xml
> > 
> > 
> > 
> > Try:
> > 
> > var myXMLList:XMLList = dataSet..Trackpoint; //NOTE CASE of
TrackPoint
> > 
> > 
> > 
> > Tracy
> > 
> > 
> > 
> > ________________________________
> > 
> > From: [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of Nate Pearson
> > Sent: Thursday, April 17, 2008 4:07 PM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com> 
> > Subject: [flexcoders] Problems walking XML file with E4X
> > 
> > 
> > 
> > So I'm new to this whole xml thing (i usually use objects).
> > 
> > I have this xml file:
> >
>
http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tra
<http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tr
a> 
>
<http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tr
<http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tr
> 
> a> 
> > iningCenterExport.courseMode=true
> >
>
<http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tr
<http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tr
> 
>
<http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tr
<http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tr
> 
> > 
> > ainingCenterExport.courseMode=true> 
> > 
> > The structure is like this:
> > <TrainingCenterDatabase>
> > <Courses>
> > <CourseFolder>
> > <Course>
> > <Track>
> > <Trackpoint/>
> > <Trackpoint/>
> > <Trackpoint/>
> > 
> > I want to get to the Trackpoint data.
> > 
> > In my App I have (I renamed the file):
> > <mx:XML id="dataSet" source="data/frankTT.xml" format="e4x" />
> > 
> > Then to put it into an XMLList I go:
> > var myXML:XML = dataSet[0]
> > var myXMLList:XMLList = myXML..TrackPoint
> > 
> > That doesn't work though, myXMLList is empty! How do I walk this
file?
> > 
> > Thanks!
> > 
> > Nate
> >
>

 

Reply via email to