473,508 Members | 2,303 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

libxml2 and node identity

I've been trying to find information with how to figure out node
identity in libxml2 - but I'm at a loss. I can't seem to find what I'm
looking for on the xmlsoft.org site and google doesn't seem to help at
all with the following query:

http://www.google.com/search?q=libxml2+node+identity

Here's a snippet to show the problem:
import libxml2
doc = libxml2.newDoc('1.0')
root = doc.newChild(None, 'root', None)
print root, doc.children <xmlNode (root) object at 0x419c60> <xmlNode (root) object at 0x4710d0> print root._o, doc.children._o

<PyCObject object at 0x221d0> <PyCObject object at 0x22170>

What I'd _like_ to do is to be able to check that two nodes are actually
identical. The Python wrappers as well as the PyCObject references
don't seem to match up. I also can't seem to find any way to do
something like "node.isSameNode(otherNode)"

Help!
Jul 18 '05 #1
1 2010
Ok - well I got a reply from Daniel Veillard, there's no way to properly
get the identity of a node in libxml2 by using the standard Python bindings.

This is a really bad since it allows you to leak memory very easily. If you
can't properly determine node identity, then you don't know if it's safe to
free the node's memory.

vic
Victor Ng wrote:
I've been trying to find information with how to figure out node
identity in libxml2 - but I'm at a loss. I can't seem to find what I'm
looking for on the xmlsoft.org site and google doesn't seem to help at
all with the following query:

http://www.google.com/search?q=libxml2+node+identity

Here's a snippet to show the problem:
>>> import libxml2
>>> doc = libxml2.newDoc('1.0')
>>> root = doc.newChild(None, 'root', None)
>>> print root, doc.children <xmlNode (root) object at 0x419c60> <xmlNode (root) object at 0x4710d0> >>> print root._o, doc.children._o

<PyCObject object at 0x221d0> <PyCObject object at 0x22170>

What I'd _like_ to do is to be able to check that two nodes are actually
identical. The Python wrappers as well as the PyCObject references
don't seem to match up. I also can't seem to find any way to do
something like "node.isSameNode(otherNode)"

Help!


Jul 18 '05 #2

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

Similar topics

0
1565
by: Juergen R. Plasser | last post by:
Hi, I have installed libxml2-2.5.7, libxslt-1.0.30 from source and the bindings libxml2-python-2.5.7. Everything seems to compile fine, but when I try to import the libxml2 library in python...
0
2127
by: Richard Mertens | last post by:
I'd like to read the attributes from a node in my xml - file, but i didn't found an example for this. Could someone help me please? I ghet the attribute count work neither. example - xml file ...
5
4008
by: Rene Olsthoorn | last post by:
Dear readers, py2exe has a problem including libxml2. Not at building time, but at runtime. The libxml2.dll cannot be loaded... Is there anyone that NOT has the problem? (and can you drop me...
1
2168
by: bdecker | last post by:
Hello, I was hoping that someone here can please answer two questions concerning libxml2 python module use: 1. Is this snippet correct? doc = libxml2.parseDoc(readfile(filename)) ctxt =...
2
6603
by: nickheppleston | last post by:
I'm trying to iterate through repeating elements to extract data using libxml2 but I'm having zero luck - any help would be appreciated. My XML source is similar to the following - I'm trying to...
1
4113
by: cesar.ortiz | last post by:
Hi all, I have created an example using libxml2 based in the code that appears in http://xmlsoft.org/python.html. My example processes an enough amount of html files to see that the memory...
1
2340
by: Andrew Marlow | last post by:
guys, I have been using libxml2 with python with no problems for just over a week but now I come to see if my script will work in someone else's environment and the libxml2 import fails. I am...
6
4530
by: saumya.agarwal | last post by:
Hi, I am using libxml2 for xml parsing. When the client application sends data to libxml2 in UTF-8 format, it works fine. But, I have a scenarion in which the client application sends data to...
2
2887
by: jianbing.chen | last post by:
Hi, I have this weird situation where on the same machine(solaris 8, python 2.5), one user can do this with no problem: <module 'libxml2' from '/usr/local/lib/python2.5/site-packages/...
0
7123
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
7382
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...
1
7042
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...
0
7495
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...
0
5627
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,...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1556
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.