Re: [Flashcoders] XPathAPI problems with wildcard searches

2006-08-04 Thread Keith Salisbury

I suspect you're expecting similar results to using XSLT where you
xsl:template match=blah statement bearing in mind this only works
when you use the xsl:apply-templates /, which crawls the tree
applying the xpath statements.

Remember all you statements are relative to the root node that you
pass in (in your example is xml)

To my knowledge the XPathAPI wont support what you want, you're need
to do some kind of recursion

May be worth looking at the other XPath library, cant remember where
it is, but a quick google will point you in the right direction i'm
sure...

On 8/1/06, Lori Hutchek [EMAIL PROTECTED] wrote:

The reason I am trying to do the wildcard search is because I have nodes
of the same name at different levels and I need them all. So giving a
specific path wouldn't give me all of the nodes I need.

Here's an expert...
xml
node nodid=cue14
/node

node nodid=cue15 
closecaptioning![CDATA[]]/closecaptioning
actions
action type=evt_post
data type=reply order=1 videofile=debate1.flv
length=55666
slides
node nodid=cue1 order=13 index=true
slidefile= printfile=slide1.jpg thumbfile=slide1.jpg type=slide


closecaptioning![CDATA[]]/closecaptioning
actions /
/node
/slides
 /action
/actions
/node
/xml

Yes * and / are mathematical operators but in the context of a xpath
search they are used as you expect if you were doing a regex search...
which also supports the * and /

What I am attempting to do is get all the node nodes by doing
r = XPathAPI.selectNodeList(myXML,/*/node);


If anyone else has experienced the same trouble and know a way around it
or know what I'm doing wrong that would be great!

Thanks!
Lori-


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ryanm
Sent: Tuesday, August 01, 2006 2:42 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] XPathAPI problems with wildcard searches

 r = XPathAPI.selectNodeList(x,/*/item);

The problem is that / and * are both node operators and math
operators,
so your statement is ambiguous. The obvious answer, based on your
example
XML, is to use ./items/item, but I don't know if your real XML is more

complex or not. If it is, you just need to make your select statement
more
explicit.

ryanm

___
Flashcoders@chattyfig.figleaf.com
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
___
Flashcoders@chattyfig.figleaf.com
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]
___
Flashcoders@chattyfig.figleaf.com
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


[Flashcoders] XPathAPI problems with wildcard searches

2006-08-01 Thread Lori Hutchek
I've been having problems with the xpathapi. I've been trying to do a
wildcard search and according to all the documentation it's supported
yet even simple straight forward search isn't working. Can anyone help? 

 

Example :

code

import mx.xpath.XPathAPI;

 

x = new XML(test thing='boo'items name='blah'item foo='bar'/item
foo='blah'//items/test);

r = XPathAPI.selectNodeList(x,/*/item);

 

for (var i in r) {

trace(r[i]);

} 

/code

 

Thanks in advance,

Lori-

___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] XPathAPI problems with wildcard searches

2006-08-01 Thread ryanm

r = XPathAPI.selectNodeList(x,/*/item);

   The problem is that / and * are both node operators and math operators, 
so your statement is ambiguous. The obvious answer, based on your example 
XML, is to use ./items/item, but I don't know if your real XML is more 
complex or not. If it is, you just need to make your select statement more 
explicit.


ryanm 


___
Flashcoders@chattyfig.figleaf.com
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


RE: [Flashcoders] XPathAPI problems with wildcard searches

2006-08-01 Thread Lori Hutchek
The reason I am trying to do the wildcard search is because I have nodes
of the same name at different levels and I need them all. So giving a
specific path wouldn't give me all of the nodes I need. 

Here's an expert... 
xml
node nodid=cue14
/node

node nodid=cue15 
closecaptioning![CDATA[]]/closecaptioning
actions
action type=evt_post
data type=reply order=1 videofile=debate1.flv
length=55666
slides
node nodid=cue1 order=13 index=true
slidefile= printfile=slide1.jpg thumbfile=slide1.jpg type=slide


closecaptioning![CDATA[]]/closecaptioning
actions /
/node
/slides
 /action
/actions
/node
/xml

Yes * and / are mathematical operators but in the context of a xpath
search they are used as you expect if you were doing a regex search...
which also supports the * and /

What I am attempting to do is get all the node nodes by doing
r = XPathAPI.selectNodeList(myXML,/*/node);


If anyone else has experienced the same trouble and know a way around it
or know what I'm doing wrong that would be great!

Thanks!
Lori-


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ryanm
Sent: Tuesday, August 01, 2006 2:42 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] XPathAPI problems with wildcard searches

 r = XPathAPI.selectNodeList(x,/*/item);

The problem is that / and * are both node operators and math
operators, 
so your statement is ambiguous. The obvious answer, based on your
example 
XML, is to use ./items/item, but I don't know if your real XML is more

complex or not. If it is, you just need to make your select statement
more 
explicit.

ryanm 

___
Flashcoders@chattyfig.figleaf.com
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
___
Flashcoders@chattyfig.figleaf.com
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


RE: [Flashcoders] XPathAPI problems with wildcard searches

2006-08-01 Thread Dave Watts
 x = new XML(test thing='boo'items name='blah'item 
 foo='bar'/item foo='blah'//items/test);
 
 r = XPathAPI.selectNodeList(x,/*/item);

If I understand correctly, that search would not find anything, because item
is not a child of test, but rather of items. If I'm reading your XPath
expression correctly, you would find /items/item, but not /test/items/item.
Valid alternative expressions would be //item, /test/*/item, /*/*/item.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] XPathAPI problems with wildcard searches

2006-08-01 Thread ryanm

The reason I am trying to do the wildcard search is because I have nodes
of the same name at different levels and I need them all. So giving a
specific path wouldn't give me all of the nodes I need.


   That's not what your select says, the * wildcard only selectes children.

/*/item = select all item nodes which are one level below the root 
(grandchildren of the context node).
//item = select all item nodes on any level of the document (all 
descendants of the context node).



Yes * and / are mathematical operators but in the context of a xpath
search they are used as you expect if you were doing a regex search...
which also supports the * and /

   If you read the W3C spec, they specifically mention this ambiguity and 
the problems that can arise. It is a known issue with wildcards in XPath, 
and you should not expect it to behave the same way as any particular 
implementation of RegEx.



What I am attempting to do is get all the node nodes by doing
r = XPathAPI.selectNodeList(myXML,/*/node);


   What you want is:

r = XPathAPI.selectNodeList(myXML,//node);

ryanm

___
Flashcoders@chattyfig.figleaf.com
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