473,395 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to get absolute XPath

Hi,

I'm trying to get the absolute xpath to a node in DOM (XmlDocument). I know
I can build it by warlking the tree recursively, but I'm wondering if there
is an API in DOM or in XPathNavigator that allows me to get the absolute
path for a given node?

Thanks,
--Ader.
Nov 12 '05 #1
2 2882


gonzalez wrote:

I'm trying to get the absolute xpath to a node in DOM (XmlDocument). I know
I can build it by warlking the tree recursively, but I'm wondering if there
is an API in DOM or in XPathNavigator that allows me to get the absolute
path for a given node?


The DOM in .NET (XmlDocument, XmlNode, etc) (at least 1.1) in my view
has no API to give you the absolute XPath expression to a node.
As for XPathNavigator I don't see any methods or properties in there
either to simply give you an XPath expression to a node.

So you are right, with XmlDocument and a node in that document you need
to walk the document tree to build that XPath.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
Thanks... that's what I was afraid of... it seems a little retarded to me to
have to walk the tree (or requery for ancestors) after doing an XPaht query,
just to build the absolute path. But I guess I have no choice for now.

Thanks again, and happy holidays!
--Ader

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...


gonzalez wrote:

I'm trying to get the absolute xpath to a node in DOM (XmlDocument). I know I can build it by warlking the tree recursively, but I'm wondering if there is an API in DOM or in XPathNavigator that allows me to get the absolute
path for a given node?


The DOM in .NET (XmlDocument, XmlNode, etc) (at least 1.1) in my view
has no API to give you the absolute XPath expression to a node.
As for XPathNavigator I don't see any methods or properties in there
either to simply give you an XPath expression to a node.

So you are right, with XmlDocument and a node in that document you need
to walk the document tree to build that XPath.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #3

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

Similar topics

0
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
4
by: Son KwonNam | last post by:
In XSLT, is this possible to get value from xml using XPath which is in XSLT variable? I mean XPath strings can be dynamic while XSL Transforming. If possible, How?? Because I'm not a...
6
by: Scott Simpson | last post by:
What is a good tool for running XPath queries on Linux? I have the O'Reilly XPath book and I'm using XPath Visualizer on Windows and that seems to work fine, but I'm looking for something on Linux....
4
by: Vitali Gontsharuk | last post by:
Hallo! When using the XPATH document() function to load a new XML document, we are coming across problems, because XALAN seems to have problems with absolute paths. XALAN always assumes that the...
5
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...
18
by: jacksu | last post by:
I have a simple program to run xpath with xerces 1_2_7 XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); XPathExpression xp = xPath.compile(strXpr);...
9
by: David Thielen | last post by:
Hi; I am sure I am missing something here but I cannot figure it out. Below I have a program and I cannot figure out why the xpath selects that throw an exception fail. From what I know they...
5
by: Gnic | last post by:
Hi , I have an XmlDocument instance, I want to find a node in the xml, but I don't know it's path until runtime, for example <aaa> <bbb name="x"/> <aaa attr="y"> <ccc>sometext</ccc> </aaa>
2
by: tomek.romanowski | last post by:
Hello everybody ! I'm looking for a while some way to select subnode element by its position within whole document rather then in its parent. Let's consider following xml: <root> <parent>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.