Hello,
I would like to simplify an XMLObject by only retrieving the XMLElements with a specific tag.
I would like a code based with the use of XMLElements as function.
I try this code :
XMLtest3 = Cases[XMLtest, _XMLElement, Infinity] //. XMLElement[tag : "YO", attributes_, data_] :> XMLElement[tag , attributes, data]
Definition of the XMLObject:
XMLtest =
XMLObject[
XMLElement["YO", {},
{XMLElement["YO", {}, 2],
XMLElement["BA", {},
{XMLElement["YO", {},
{XMLElement["BA", {}, 2]}], XMLElement["BA", {}, 2]}]}]]
I would like to keep only the XMLElements with the tag "YO" and to preserve a tree structure for the XMLObject.
May you help me to correct the code given?
Thank you for your help