[gdome]libxml and namespace declaration attributes



i played around a little bit with making namespace declaration attributes 
work with getAttributes, getAttribute, etc, by searching "nsDef" as well 
as "properties", and i realized that this is going to be very complicated.
furthermore, this would not be fully compliant with DOM.  for example, 
setting an attribute with the same name as an existing namespace 
declaration attribute would result in the attribute being printed out 
twice!

it would simplify things a *lot* if libxml's "properties" in the node 
structure contained all attributes including namespace declarations.  
would it be possible make this a run-time option for libxml?  by 
enabling that option, libgdome would be DOM compliant for ns decl attrs!

this would be consistent with the DOM, where the changes to the namespace 
decl attrs do not change the namespaces hardcoded to the nodes.

i took a look at the libxml2 source, and it doesn't seem that hard to do.
basically, in SAX.c:attribute, call xmlNewNsProp as well as xmlNewNs for
namespace decls, and in tree.c:xmlNsDump simply return without printing
anything.

we could make this option turned off by default, as to not break any 
pre-existing code.

-tj




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