473,770 Members | 5,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Will this XPath exp ever select anything?

/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

Jul 20 '05 #1
2 1096
In article <Ly************ *********@news0 00.worldonline. dk>,
Soren Kuula <dongfang-remove_this@rem ove_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
Jul 20 '05 #2
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

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1929
by: gael.pegliasco | last post by:
Hi, How are you dear and nice helper :) ? I'm trying to test xpath with this simple program : import xml.dom.minidom from xml.xpath.Context import Context import xml.xpath
2
2973
by: kj | last post by:
Suppose I have some XML document that contains tags of the form <... xmlns:foo="http://www.bar.org/foo"> <... xmlns:foo="baz"> <... xmlns:frobozz="http://www.bar.org/foo"> What's the XPath expression to select the namespace nodes with prefix "foo"? And what's the XPath expression to select the
4
1729
by: Anon | last post by:
Hi, to not deceive you this is a school project. We are developing some XSLT to format some data in HTML for Internet Explorer. The work uses XSLT and CSS and XML. The objective is to write a search form, the user enters details in a browser window, presses the "search" button, and books that match the search criteria are displayed in a table formatted with pretty colours. We have a problem. We thought the XML searched by the...
1
1239
by: gimme_this_gimme_that | last post by:
I have the following xml file and need some tips on xpath queries to fetch the data. I think I'm not handling namespaces correctly. Here is xml file : <?xml version="1.0" encoding="UTF-8"?>
2
1794
by: dingbat | last post by:
Losing my marbles here (some sleep would help!) Why are the following XPath comparisons both returning false ? <xsl:value-of select="string('2005-09-22T12:43:23') &gt; string('2005-09-15T14:06:58')" /> <xsl:value-of select="string('2005-09-15T14:06:58') &gt; string('2005-09-22T12:43:23')" />
5
4212
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple values in the where clause as below
6
4939
by: dotnetnoob | last post by:
i would like to know how i can build xpath expression dynamiclly. let's say i have a following xml file: <EventEnrollment InstanceNumber = "675"> <EventSource> <ObjectReference ObjectKey="xxxxx"> .. .. .. <EventEnrollment InstanceNumber = "676">
1
718
by: SiJP | last post by:
Consider the following XML <?xml version="1.0" encoding="UTF-8"?> <Root> <Data> <ID>1005</ID> <Reference> <Reference>ABC</Reference> <Country>UK</Country> </Reference>
3
3090
by: Arndt Jonasson | last post by:
Let's say we have a schema (maybe expressed in XML Schema, but not necessarily so), that allows this instance document: <top> <txt>This is text</txt> <books> <book>Tarzan</book> <book>Harry Potter</book> </books> </top>
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8891
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.