All,

I am looking at using BaseX for a prototype that requires synchronization of XML data. In other words, XML documents may need to be merged and there might be conflicts.

This seems like a complex issue and I wonder if anyone has conquered this before. The only thing that I can think of to do is to version nodes which may have conflicts. For example:

<person>
  <name>
    <first version="2">Erik</first> <!-- Version 2 has been added since I last synchronized! -->
    <last version="1">Murphy</last>
  </name>
</person>

If I do a merge and the <first> version is >= last known version (1) + 1 ( which is 2 or greater), then I would know there is a conflict.

A possible solution is there could be a deferment of conflict resolution, and data could be inserted like this:

<person>
  <name>
    <first version="3">Eric</first> <!-- Conflict! -->
    <first version="2">Erik</first>
    <last version="1">Murphy</last>
  </name>
</person>

The application would be responsible for resolving the conflict when the nodes are read at a later time.

Like I said, this all seems very complicated, so maybe there is an elegant solution which I have not thought of.

Thank you,
Eric Murphy