Hi

I have been trying to figure out how to programmatically create a  
Node with a namespace but without any luck.

I have tried this:

node = XML::Node.new('test')
node.namespace = 'http://example.org'

But that just results in a segfault.

I have tried creating XML::NS objects but there doesn't seem to be a  
way to set any of it's attribute.

The only way I can figure out how to do it is:

node = XML::Node.new('test')
node['xmlns'] = 'http://example.org'

Which results in the following output:

<test xmlns="http://example.org"/>

Which is valid, but it means that I either have to assign and manage  
all the namespace prefixes myself or I have to specify a new local  
namespace for each element in a different namespace in the document,  
which is a bit ugly.

So, is there a better way?

Sean
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to