I have an XML file with a bunch of data contained by custom tags. This is all useful for one project I have, but for another project I don't need so much info. So I'd like to trim the XML file, and get rid of all instances of certain tags and whatever is between the tags.
<GOBJ>
<cost>4</cost>
<duration>n/a</duration>
<item>Stone Block</item>
<type>Construction - Material</type>
<misc>Use these blocks to build things. These blocks don't degrade.</misc>
</GOBJ>
I only want to keep [item]blah[item]
and [type]blah[type]
, the rest should be deleted/removed.
Later on, I will need to check the text of [type]
and replace its contents if it matches certain words. For example, if the word metal is anywhere within the [type]
tag, then replace the contents of that tag with just the word metal.
I know this is a big request; I appreciate any help.