My question is about a XML document and finding parts of strings.
test = Import["C:\\Users\\filename.xml", "XMLObject"]
This gives the following output:
XMLObject["Document"][{XMLObject["Declaration"]
["Version" -> "1.0", "Encoding" -> "UTF-8", "Standalone" -> "yes"]},
XMLElement["file", {"name" -> "filename.xml"},
{XMLElement["tekst", {"write" -> "test1"},
{XMLElement["relation", {"type" -> "co-synonyms", "freq" -> "3"},
{XMLElement["lu", {"sense" -> "2", "id" -> "AA-504771"}, {}],
XMLElement["lu", {"sense" -> "1", "id" -> "BB-59362"}, {}],
XMLElement["lu", {"sense" -> "1", "id" -> "CC-59362"}, {}]}]}],
XMLElement["tekst", {"write" -> "test2"},
{XMLElement["relation", {"type" -> "co-synonyms", "freq" -> "2"},
{XMLElement["lu", {"sense" -> "2", "id" -> "AA-20210"}, {}],
XMLElement["lu", {"sense" -> "3", "id" -> "BB-30211"}, {}]}]}],
XMLElement["tekst", {"write" -> "test3"},
{XMLElement["relation", {"type" -> "co-synonyms", "freq" -> "2"},
{XMLElement["lu", {"sense" -> "2", "id" -> "AA-445227"}, {}],
XMLElement["lu", {"sense" -> "1", "id" -> "BB-629609"}, {}]}]}],
XMLElement["tekst", {"write" -> "test4"},
{XMLElement["relation", {"type" -> "co-synonyms", "freq" -> "2"},
{XMLElement["lu", {"sense" -> "1", "id" -> "AA-7799"}, {}],
XMLElement["lu", {"sense" -> "2", "id" -> "BB-407682"}, {}]}]}]}], {}]
The XML has a fixed structure. I want the combination of the XML where "write" -> "test1" and "id" -> "BB-59362"
The desired output is:
{test1, {AA-504771,BB-59362,CC-59362}}, test2, {AA-20210, BB-30211}, test3, {AA-445227,BB-629609}, test4, {AA-7799, BB-407682}}
I tried several syntaxes with, for example, XMLElement. The result in each case was output with XML. Does anyone have a suggestion on how to solve this problem?