This is a question about concept.
I have an XML file, let's call it base:
<base id="default">
<tags>
<tag>tag_one</tag>
<tag>tag_two</tag>
<tag>tag_three</tag>
</tags>
<data>
<data_a>blue</data_a>
<data_b>3</data_b>
</data>
</base>
What I want to do is to be able to extend this XML in another file, modifying individual properties. For example, I want to inherit that file and make a new one with a different data/data_a node:
<base id="green" import="default">
<data>
<data_a>green</data_a>
</data>
</base>
So far it's pretty simple, it replaces the old data/data_a with the new one. I even can add a new node:
<base id="ext" import="default">
<moredata>
<data>extended version</data>
</moredata>
</base>
And still it's pretty simple. The problem comes when I want to delete a node or deal with XML Lists (like the tags node).
How should I reference a particular index on a list? I was thinking doing something like:
<base id="diffList" import="default">
<tags>
<tag index="1">this is not anymore tag_two</tag>
</tags>
</base>
And for deleting a node / array index:
<base id="deleting" import="default">
<tags>
<tag index="2"/>
</tags>
<data/>
</base>
<!-- This will result in an XML containing these values: -->
<base>
<tag>tag_one</tag>
<tag>tag_two</tag>
</base>
But I'm not happy with my solutions. I don't know anything about XSLT or other XML transformation tools, but I think someone must have done this before.
The key goal I'm looking for is ease to write the XML by hand (both the base and the "extended").
I'm open to new solutions besides XML, if they are easy to write manually.
Thanks for reading.