I'm processing XML using Rhino 1.7R3 and have trouble accessing xml:id
attribute.
var bond = new XML('<person xml:id="007" profession="agent">James Bond</person>');
print(bond); // "James Bond"
print(bond.@profession); // "agent"
print(bond.@xml:id); // ERROR: missing ) after argument list
I tried putting xml:id
inside quotes and square brackets but it didn't solve the problem. Is there a way?
EDIT: I got it working by defining namespace. After that both of the methods Siva suggests work:
var xml = new Namespace("xml", "http://www.w3.org/XML/1998/namespace");
var bond = new XML('<person xml:id="007" profession="agent">James Bond</person>');
print(bond); // "James Bond"
print(bond.@profession); // "agent"
print(bond.@xml::id); // "007"
print(bond..@xml::id); // "007"