I'm still new in programming but I know some Python and am familiar with XPath and XML in general. Currently I'm working with some XML data that looks something like this:
<foo>
<bar>
<unit>
<structure>
<token word="Rocky" att1="noun" att2="name">Rocky</token>
<token word="the" att1="article" att2="">the</token>
<token word="yellow" att1="adjective" att2="color">yellow</token>
<token word="dog" att1="noun" att2="animal">dog</token>
</structure>
</unit>
</bar>
</foo>
Now what I need to do with this is to first find an attribute value, let's take
<token word="dog" att1="noun"att2="animal"</token>
for an instance. So in all the structures in the document I want to first find all the nodes that have animal as the att2 value and THEN get all the siblings of that node into a list. Because the nodes have several attributes each, I'm trying to include each one of them into a different list, that is to say make a list out of all the attributes in the structure that has the animal in one of its childrens' att2 value. For instance:
listWord = [Rocky, the, yellow, dog]
listAtt1 = [noun, article, adjective, noun]
listAtt2 = [name, ,color, animal]
At the moment I'm just wondering if it's even possible. Thus far I've only managed to hit my head against the wall with the attribute structure not to mention the empty values.
<token>tags are missing the closing>, maybe a copy and paste error.listWordlistAtt1andlistAtt2the lists you are trying to build ?