Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Will this XPath exp ever select anything?

Reply
Thread Tools

Will this XPath exp ever select anything?

 
 
Soren Kuula
Guest
Posts: n/a
 
      04-10-2005
/a//b[/b]//a

?

- or am I wrong in that it will never select a node for any document?

I read it "the document element must be an 'a' element; there must be a
'b' element x which is a descendant of the document element, or is the
element. Furthermore, the document element must be a 'b' element, and x
is an 'a' element or has an 'a' descendant...

-- so, the document element is an 'a' and 'b' element at the same time.
Not many documents like that around. Or did I misunderstand something
about the absolute path exp in the predicate?

Found the expression in "Automata theory for XML researchers", by Frank
Neven.

Soren

 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      04-10-2005
In article <Lyf6e.111061$(E-Mail Removed)> ,
Soren Kuula <dongfang-remove_this@remove_this-bitplanet.net> wrote:

>/a//b[/b]//a


>- or am I wrong in that it will never select a node for any document?


No, you're right. It means an "a" descendant of a "b" that is in a
document with a "b" root element and which is a descendant of the "a"
root element. So it can never match.

Perhaps it was meant to be

/a//b[b]//a

or something similar.

-- Richard
 
Reply With Quote
 
 
 
 
Soren Kuula
Guest
Posts: n/a
 
      04-10-2005
Hi, Richard,

Richard Tobin wrote:
> No, you're right. It means an "a" descendant of a "b" that is in a
> document with a "b" root element and which is a descendant of the "a"
> root element. So it can never match.


Yes, I should of course have expressed myself in terms of the final 'a'
element that would have been the result of the match, with the predicate
corrected, and a suitable tree.

> Perhaps it was meant to be
>
> /a//b[b]//a


Yes. I will see if I can rewrite his language for XPath match
determination to work .. if I get it right, I must have understood his
article then

Hey, wouldn't

/a//b
and
//b[/a]

always match the same nodes (leaving out any discussion of which look
the prettiest ?

There's also an example of an NFA with two states -- both acceptor
states, and no transitions undefined or leading to a no-state condition.
It's supposed to match only some strings. I guess the article was rushed
out

Thanks.

Soren

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Memory leak" in javax.xml.xpath.XPath Marvin_123456 Java 4 07-29-2005 03:49 PM
don't you ever, don't you ever, lower yourself, forgetting all your standards Jason ASP .Net Web Controls 0 07-06-2004 12:50 PM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM
XPath that does not include other XPath Anna XML 0 07-31-2003 07:55 AM
Problem selecting a node with XPATH if attribute value contains backslashes - how to force XPATH string to be treated as literal? Alastair Cameron XML 1 07-08-2003 07:24 PM



Advertisments