I have a node like this:
<tree id="tree1" xsi:type="nex:IntTree" >
...
</tree>

Now I parse this from a file using XML::Document.file, and query for the
"xsi:type" attribute. The XML::Attr object that represents the "xsi:type"
attribute for the given node is linked with the xsi namespace automatically
and it identifies only "type" as its name rather than "xsi:type":

>> attr.ns?
=> true
>> attr.ns
=> "xsi:http://something.org";
>> attr.name
=> "type"

But I am unable to assign a namespace to an attribute when creating it by
hand( using the new method )
>> node = XML::Node.new 'tree'
>> n = XML::Namespace.new node, 'xsi', "http://something.org";
>> a = XML::Attr.new node, "xsi:type", "nex:IntTree"
# get the attribute representing "xsi:type"
>> attr.ns?
=> false
>> attr.name
=> "xsi:type"

How can I assign a namespace to an attribute or remove the namespace?

-- 
Anurag Priyam,
2nd Year Undergraduate,
Department of Mechanical Engineering,
IIT Kharagpur.
+91-9775550642
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to