472,780 Members | 1,434 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,780 software developers and data experts.

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 1974
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
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
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
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
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
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
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
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
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
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
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
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

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.