Not sure if this is it but your first question shows a typo for the name
Trackpoint.

 

var myXMLList:XMLList = myXML..TrackPoint

 

You capitalized the P..

 

Other than that why the [0] for DataSet




var myXML:XML = dataSet[0]

 

I always use HTTPService to retrieve the data via E4X but always refer to
the data as dataSet without a [0].

 

dataSet..Trackpoint

 

Just a stab in the dark.

 

Dan

 

 

 

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Thursday, April 17, 2008 6:13 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: Problems walking XML file with E4X

 

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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Nate Pearson
Sent: Thursday, April 17, 2008 4:44 PM
To: flexcoders@yahoogroups.com
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.
<http://www.adobe.com/2006/mxml> 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> ups.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> ups.com
[mailto:[EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.com]
On
> Behalf Of Nate Pearson
> Sent: Thursday, April 17, 2008 4:19 PM
> To: [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.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> ups.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> ups.com
<mailto:flexcoders%40yahoogroups.com>
> [mailto:[EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.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> ups.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.
<http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tra>
motionbased.com/trail/export.mb?episodePkValues=5413584&tra
> <http://trail.
<http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tr>
motionbased.com/trail/export.mb?episodePkValues=5413584&tr
> a> 
> > iningCenterExport.courseMode=true
> >
> <http://trail.
<http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tr>
motionbased.com/trail/export.mb?episodePkValues=5413584&tr
> <http://trail.
<http://trail.motionbased.com/trail/export.mb?episodePkValues=5413584&tr>
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