Hey folks-
I'm looking into this now. The correct way to look for attributes inside a
namespace appears to be:

var idQN:QName = new QName(kml, "id");
this._id = ParsingTools.nullCheck(this.x.attribute(idQN));

More information is in the reference:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/XML.html#attribute()

The most flexible method is to just look for the attribute without any
namespace- it looks like that will always find it.

I'll post a new version of KMLParser soon that contains this and other
fixes.
- pamela

On Tue, Mar 17, 2009 at 2:56 AM, cyrt <[email protected]> wrote:

>
> I just had the same problem with the style-id and apparently changing
> the code to "x...@id " solves it. Is it ok to change the code without
> having to deal with any  unexpected errors?
>
> On Mar 14, 12:21 am, Amit Pal <[email protected]> wrote:
> > I think this is the correct syntax but it didn't work either:
> >
> > *this...@kml::id*
> >
> > My XML looks like:
> >
> > <kml xmlns="http://earth.google.com/kml/2.2";>
> >     <Document>
> >         <name>WeatherAlerts.kml</name>
> >         <Style id="FloodAdvisory">
> >             <IconStyle>
> >                 <color>00FF99</color>
> >             </IconStyle>
> >         </Style>
> >         <Style id="Special Weather Statement">
> >             <IconStyle>
> >                 <color>FFCC99</color>
> >             </IconStyle>
> >         </Style>
> >         <Folder>
> >             <name>Flood Advisory</name>
> >             <Placemark>
> >                 <name>Flood</name>
> >                 <description><![CDATA[ <title>San Bernardino, Riverside
> > Counties (California)</title><html><b>Effective: </b>Mon Mar 9 11:19:21
> > GMT-0700 2009<b>Expire: </b>Tue Mar 10 11:19:21 GMT-0700 2009<b>Severity:
> >
> </b>Extreme<b>Certainty:</b>Observed<b>County:</b>RIVERSIDE</html>]]></description>
> >                 <styleUrl>#FloodAdvisory</styleUrl>
> >                 <Point>
> >                     <coordinates> -121.60,38.7,0 </coordinates>
> >                 </Point>
> >             </Placemark>
> >         </Folder>
> >         <Folder>
> >             <name>Special Weather Statement</name>
> >             <Placemark>
> >                 <name>Statement</name>
> >                 <styleUrl>#Special Weather Statement</styleUrl>
> >                 <description><![CDATA[<title>Some title</title><html>
> > <b>HTML text here</b></html>]]></description>
> >                 <Point>
> >                     <coordinates>-117.13,32.82,0 </coordinates>
> >                 </Point>
> >             </Placemark>
> >         </Folder>
> >     </Document>
> > </kml>
> >
> > On Fri, Mar 13, 2009 at 3:06 PM, Amit Pal <[email protected]>
> wrote:
> > > Hi Pamela,
> >
> > > Looks like I can't access attribute from a namespace qualified
> expression:
> >
> > > this.x.kml::@id -- is syntactically wrong
> >
> > > this.x.kml::x...@id --  doesn't returns anything
> >
> > > x...@id -- This works
> >
> > > Should I use the last one?
> >
> > > Thanks,
> > > Amit
> >
> > > On Fri, Mar 13, 2009 at 2:05 PM, pamela fox <[email protected]>
> wrote:
> >
> > >> Hi Amit-
> >
> > >> I looked into it, and you are correct.
> >
> > >> The fix should be to change the following in KMLObject.as (adding the
> > >> "@" symbol):
> > >>                public function KmlObject(x:XMLList)
> > >>                {
> > >>                        super(x);
> > >>                        this._id =
> ParsingTools.nullCheck(this.x.kml::@id
> > >> );
> > >>                }
> >
> > >> If you'd like, send me the KML file you're working with and I'll use
> > >> it to make a demo with id/style.
> > >> Sorry for the confusion.
> >
> > >> - pamela
> >
> > >> On Fri, Mar 13, 2009 at 8:29 AM, Amit Pal <[email protected]>
> > >> wrote:
> > >> > Hi Pamela,
> >
> > >> > Thanks for adding styleUrl. I tried it but still the 'id' is NULL.
> >
> > >> > Looks like the parser can't extract attribute 'id' of the <Style>
> > >> element.
> > >> > KMLObject expects 'id' to be an element.
> >
> > >> > Please let me know if my understanding is correct?
> >
> > >> > -Amit
> >
> > >> > On Sun, Mar 8, 2009 at 4:35 AM, pamela fox <[email protected]>
> > >> wrote:
> >
> > >> >> Hi Amit-
> >
> > >> >> The 'id' in Style is inherited from KMLObject, so that is there.
> I've
> > >> >> just added support for styleUrl to the Feature class, it's in the
> > >> >> latest download and revision.
> >
> > >> >> Cecil is working on a demo of the features he added. "Style" in KML
> > >> >> crosses a lot of elements, so we likely don't have 100% support.
> >
> > >> >> - pamela
> >
> > >> >> On Thu, Mar 5, 2009 at 4:44 AM, Amit Pal <[email protected]>
> > >> wrote:
> > >> >> > Thanks.Yes I saw the classes. When I was trying to use it , I
> > >> couldn't
> > >> >> > find
> > >> >> > a placeholder for styleUrl in the Placemark and 'id' in the
> 'Style'.
> > >> Is
> > >> >> > it
> > >> >> > still under development and somebody working on an example?
> >
> > >> >> > -Amit
> >
> > >> >> > On Wed, Mar 4, 2009 at 6:28 AM, pamela fox <[email protected]
> >
> > >> wrote:
> >
> > >> >> >> Yes, Cecil added support. There's no demo for it yet, but the
> parser
> > >> >> >> classes are there.
> >
> > >> >> >> - pamela
> >
> > >> >> >> On Tue, Mar 3, 2009 at 2:18 PM, Pal <[email protected]>
> > >> wrote:
> >
> > >> >> >> > Hi,
> >
> > >> >> >> > Has anybody added support for <Style> in the KMLParser
> utility?
> >
> > >> >> >> > -Amit
> >
> > >> >> >> --
> > >> >> >> ----------------------------
> > >> >> >> "if you can imagine it, you can do it"
> > >> >> >>http://imagine-it.org
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to