How one can access attributes with namespaces? My XML data are in a form
val d = <z:Attachment rdf:about="#item_1"></z:Attachment>
but the following does not match the attribute
(d \\ "Attachment" \ "@about").toString
If I remove the namespace component from the attribute’s name then it works.
val d = <z:Attachment about="#item_1"></z:Attachment>
(d \\ "Attachment" \ "@about").toString
Any idea how to access attributes with namespaces in Scala?
The API documentation refers to the following syntax
ns \ "@{uri}foo".In your example there is no namespace defined, and it seems Scala considers your attribute as unprefixed. See
d.attributes.getClass.Now if you do this:
Then: