The xpath library included with Flash 8 is really quite basic, as it
is the bare minimum for generated paths for databinding purposes. It
only permits abbreviated syntax (though this is fine and preferable
most of the time), doesn't support any axes other than "child" (e.g.
you can't do a//b or a/../c), and only supports position filtering in
predicates. (e.g. you can do x/y[1], but you can't do x/y[last()]).

XFactorStudio's XPath is complete (or at least I haven't found
anything that wasn't supported).

If you need XPath for an AS3 (or Flex 2/3) project, I have written a
library, xpath-as3, which is also a complete implementation.
http://code.google.com/p/xpath-as3

Peter


On 7/24/07, David Ngo <[EMAIL PROTECTED]> wrote:
Correct, but for most parsing functionality, the ones included in Flash 8
should be sufficient.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Merrill,
Jason
Sent: Tuesday, July 24, 2007 2:00 PM
To: [email protected]
Subject: RE: [Flashcoders] CDATA Html Text not working

But only a partial one, right?  That's what I understood - others have
commented on it.  I have used xfactorstudios Xpath classes instead.  AS3
takes care of it though if you can go that route.

Jason Merrill
Bank of America
GT&O Learning & Leadership Development
eTools & Multimedia Team




>>-----Original Message-----
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED] On Behalf
>>Of David Ngo
>>Sent: Tuesday, July 24, 2007 1:55 PM
>>To: [email protected]
>>Subject: RE: [Flashcoders] CDATA Html Text not working
>>
>>If you're using Flash 8, XPath was already integrated into
>>its library/API.
>>
>>
>>-----Original Message-----
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED] On Behalf
>>Of Chris W.
>>Paterson
>>Sent: Tuesday, July 24, 2007 1:44 PM
>>To: [email protected]
>>Subject: Re: [Flashcoders] CDATA Html Text not working
>>
>>Great!  That works!  Thanks so much!!
>>
>>I'll look into that XPath... Maybe not for this project since
>>it's on a tight deadline, but for the future!
>>
>>Thanks!
>>Chris
>>
>>--- Alan MacDougall <[EMAIL PROTECTED]> wrote:
>>
>>> Chris W. Paterson wrote:
>>> >
>>this.firstChild.childNodes[i].firstChild.childNodes[j].childNodes;--
>>> > -
>>this is how I am trying
>>> to
>>> > access the content of that node.
>>> >
>>> > First off, I'm guessing I should use .nodeValue?  Will
>>that give me
>>> > the
>>entire node with
>>> > "<![CDATA[]]>"?  Is it even possible to read the html
>>value for html
>>text?
>>> >
>>>
>>> Yep, there's the problem. The content of an XML node is a node in
>>> itself
>>> -- it's just a text node. It looks like this:
>>>
>>> <foo>my text</foo>
>>>
>>> <foo> --> part of node A
>>> my text --> node B
>>> </foo> --> part of node A
>>>
>>>
>>> So to get the text inside that <foo> tag, let's say we have:
>>>
>>> var fooNode:XMLNode;
>>> var textNode:XMLNode = fooNode.firstChild; var myText:String =
>>> textNode.nodeValue; myTextField.htmlText = myText; // now it should
>>> look right
>>>
>>> As you can see, the child node of <foo> is an XMLNode which
>>contains
>>> the text -- it's not the string itself. I've used CDATA in
>>XML plenty
>>> of times, and your HTML text fields will interpret the HTML
>>as long as
>>> you're getting the string value of the text node.
>>>
>>> As for all that confusing child.firstChild.childNodes[n].child
>>> business, may I suggest XFactorStudios' excellent XPath
>>implementation?
>>> www.xfactorstudio.com -- and then you can specify your XML
>>with simple
>>> syntax like this:
>>>
>>> // gets an Array of XMLNodes; specifically, all <bar>
>>inside a <foo>,
>>> starting from rootNode var nodes:Array =
>>XPath.selectNodes(rootNode,
>>> "foo/bar");
>>>
>>> It's a less confusing than manually walking the XML tree,
>>and allows
>>> some pretty complex searches once you really get into it. (
>>> http://www.w3.org/TR/xpath is very dense, but section 2 may
>>give you
>>> an example of XPath's power.)
>>>
>>> _______________________________________________
>>> [email protected]
>>> To change your subscription options or search the archive:
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>
>>> Brought to you by Fig Leaf Software
>>> Premier Authorized Adobe Consulting and Training
>>> http://www.figleaf.com http://training.figleaf.com
>>>
>>
>>
>>
>>
>>
>>
>>
>>
>>______________________________________________________________
>>______________
>>________
>>Got a little couch potato?
>>Check out fun summer activities for kids.
>>http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activit
>>ies+for+kids&c
>>s=bz
>>_______________________________________________
>>[email protected]
>>To change your subscription options or search the archive:
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>Brought to you by Fig Leaf Software
>>Premier Authorized Adobe Consulting and Training
>>http://www.figleaf.com
>>http://training.figleaf.com
>>
>>_______________________________________________
>>[email protected]
>>To change your subscription options or search the archive:
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>Brought to you by Fig Leaf Software
>>Premier Authorized Adobe Consulting and Training
>>http://www.figleaf.com
>>http://training.figleaf.com
>>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to