Re: [xml] Invalid namespace definitions after namespace change



On Mon, Feb 28, 2005 at 10:20:15AM -0500, Daniel Veillard wrote:
  DOM and libxml2 are completely different because in libxml2 the namespace
informations are shared, if you modify the namespace node you instead of just
changing the anmespace pointer then you:

    1/ don't have to chase all the other nodes to make the same change
    2/ don't need to creat new namespaces node and try to track and remove
       the old namespace informations

It seems there is no way to modify an existing namespace in python.

import libxml2
d=libxml2.parseDoc("<a xmlns='http://a'/>")
r=d.getRootElement()
r.ns().content
'http://a'
r.ns().setContent("http://b";)
r.ns().content
'http://a'
r.ns().content="http://b";
r.ns().content
'http://a'
d.serialize()
'<?xml version="1.0"?>\n<a xmlns="http://a"/>\n'

Greets,
        Jacek



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]