472,805 Members | 1,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Do XmlNode's have a unique internal system ID?

Hello all,

Do System.Xml.XmlNode's have a unique system ID available via a
property somehow?

I have nodes which may be very similar or even identical (but in
different locations) in a document and need to be able to look them up
via this ID. I have for now assigned my own GUID to each node, and can
use XPATH to grab the node I need, but I'm sure the DOM objects must
have something internal I could use instead and be much more efficient.

Many thanks for any help - have a super evening!

Cheers,
Rich
Nov 12 '05 #1
3 2265
Hello!

You can use XPath's generate-id() function which will return an unique
ID for a given node.

XmlDocument a = new XmlDocument();
a.Load("c:\foo.xml");
XmlDocument b = new XmlDocument();
b.Load("c:\foo.xml");

a.CreateNavigator().Evaluate("generate-id(/root/element[1])");
b.CreateNavigator().Evaluate("generate-id(/root/element[1])");

This will maybe not return the same value.
--
Pascal Schmitt
Nov 12 '05 #2

"Pascal Schmitt" <ne*******@cebra.nu> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hello!

You can use XPath's generate-id() function which will return an unique ID
for a given node.


The generate-id() function is only available to XPath in a context
established by XSLT. Trying to evaluate in a non-XSLT context an XPath
expression containing generate-id() results in an error, due to this
function not being recognised.

Cheers,
Dimitre Novatchev.
Nov 12 '05 #3
Hello!
You can use XPath's generate-id() function which will return an unique ID
for a given node.


The generate-id() function is only available to XPath in a context
established by XSLT. Trying to evaluate in a non-XSLT context an XPath
expression containing generate-id() results in an error, due to this
function not being recognised.


Oh, sorry :S

That's why I didn't find anything about it in the XPath Spec..., thanks.

--
Pascal Schmitt
Nov 12 '05 #4

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

Similar topics

1
by: Michael Hutchinson | last post by:
When an XmlNode method returns an XmlNode, such as a child, is this generated on-the-fly or is it the actual component of the internal tree structure? If the parent is moved in the tree, will the...
3
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
3
by: Siu | last post by:
Hi, I've loaded an XmlDocument from a file XML: this file has many similar XmlNode and it is difficult to select them by using SelectSingleNode of the object XmlDocument. I've this question: is...
5
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
3
by: Mae | last post by:
Dear All, I have a problem here, I'm using C# Webform calling a webservices. The webservices return me a XMLnode, using this XMLnode I want to convert it to dataset so I can bind to the...
4
by: nondisclosure007 | last post by:
Hello all! I have something rather unique. I'm creating a cookie for customization for a webpage. But I want to tie the user to a machine (not friendly, I know, but for what I'm doing, it's...
10
by: Laurence | last post by:
Hi there, How to differentiate between unique constraint and unique index? These are very similar but I cannot differentiate them? Could someone give me a hand? Thanks in advance
5
by: GaryDean | last post by:
I have a web service method that returns an XMLDocument. The signature is: public XmlDocument GetPOs() The following client code calls this method but it accepts an XMLNode instead of an...
1
by: Andrus | last post by:
How to remove whole Xmlnode so that outer tags are also removed ? To reproduce, run the code. Observed result: <Query> <DataSourceName>DS1</DataSourceName> <QueryParameters>...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.