On Sun, Jul 17, 2011 at 06:21:36PM -0700, James C. wrote:
> hello,
> I am trying to create an analytics tool on an xml file and would like
> to be able to know the exact item in the xml tree that was added,
> created or deleted.  For example,
> <parent>
>   <child>A</child>
>   <child>B</child>
>   <child>C</child>
> </parent>
> Make a change and remove child B so now the file looks like the below:
> <parent>
>   <child>A</child>
>   <child>C</child>
> </parent>
> git diff will tell be that line 3 has been removed, but what i would
> really like to know is that <parent> has been changed. What would be
> perfect would be DOM access based on the change. Not sure if this is
> possible or not.  Any ideas would be great. Thank you

There's two steps to breaking down this problem.

Step one is a tool that can compare two XML files and show you
the DOM information you want to see.  You might have to write
it yourself, or maybe you can find one that does this already.
It should take both files as input on the command-line.
Even better would be if it also allowed you to compare
three files (where one is the merge-base) as well.

It looks like someone may have already written something that
is either very close or identical to what you're looking for:


The next step is to integrate it with git.  You can customize
"git difftool" and "git mergetool" and create a custom tool
which can call your tool.  Here's an example for difftool:

Let's say the tool is called 'xmldiff'.
You can teach difftool about it by setting:

% git config --global difftool.xmldiff.cmd 'xmldiff "$LOCAL" "$REMOTE"'

..and then invoke it using difftool:

% git difftool -t xmldiff -- foo.xml

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to