M
mandibdc
I need to extract some elements from a very large XML file. Because of
the size, I'd like to work with it on my Linux machine as a text file.
Basically, I am going to have a list of specific strings I'm searching
for. For each string, I need to search through the XML file, and when
I find that string (in the tag <code>), copy the entire <item> XML
element that the code appears in, into another text file.
The XML document is comprised of a bunch of <item> elements:
<?xml version="1.0" encoding="UTF-8"?>
<item>
<property1>100</property1>
<property2>
<id>0</id>
<code>ThisIsTheStringINeedToMatch</code>
</property2>
<keyword>
<value>value1</value>
<value>value2</value>
</keyword>
<color>
<type>21</type>
<shade>1</shade>
</color>
</item>
How would you approach this? I can write a script to find each code,
but I'm not sure how to then search forwards/backwards to extract the
DNA element.
Thanks!
M
the size, I'd like to work with it on my Linux machine as a text file.
Basically, I am going to have a list of specific strings I'm searching
for. For each string, I need to search through the XML file, and when
I find that string (in the tag <code>), copy the entire <item> XML
element that the code appears in, into another text file.
The XML document is comprised of a bunch of <item> elements:
<?xml version="1.0" encoding="UTF-8"?>
<item>
<property1>100</property1>
<property2>
<id>0</id>
<code>ThisIsTheStringINeedToMatch</code>
</property2>
<keyword>
<value>value1</value>
<value>value2</value>
</keyword>
<color>
<type>21</type>
<shade>1</shade>
</color>
</item>
How would you approach this? I can write a script to find each code,
but I'm not sure how to then search forwards/backwards to extract the
DNA element.
Thanks!
M