Altova DiffDog Server 2024 

For XML files, you can view the comparison results as XML report only. To understand how differences are reported in XML format, let's assume that the following two XML files must be compared side-by-side:

 

<book id="1">  
  <author>Mark Twain</author>
</book>

<book id="2">
  <author>Franz Kafka</author>
</book>

 

If you compare these two files with the command

 

<executable> diff file1.xml file2.xml --mode=xml --output-mode=xml --output-file=report.xml

 

then the resulting XML report would look similar to the one below:

 

<?xml version="1.0" encoding="UTF-8"?>
<!-- Differencing export generated by Altova DiffDog Server -->
<diff_result>
  <diff_info comparison_mode="xml">
    <source_left name="c:\file1.xml" uri="file:///c:/file1.xml"/>
    <source_right name="c:\file2.xml" uri="file:///c:/file2.xml"/>
  </diff_info>
  <xml_diff>
    <left_location>
        <parent xpath="/book"/>
        <position>1</position>
    </left_location>
    <right_location>
        <parent xpath="/book"/>
        <position>1</position>
    </right_location>
    <left_content>
        <attribute id="1"/>
    </left_content>
    <right_content>
        <attribute id="2"/>
    </right_content>
  </xml_diff>
  <xml_diff>
    <left_location>
        <parent xpath="/book/author"/>
        <position>1</position>
    </left_location>
    <right_location>
        <parent xpath="/book/author"/>
        <position>1</position>
    </right_location>
    <left_content>
        <element>Mark Twain</element>
    </left_content>
    <right_content>
        <element>Franz Kafka</element>
    </right_content>
  </xml_diff>
</diff_result>

DiffDog Server comparison report (for XML files)

At the very top, the XML report contains a diff_info element. The diff_info element supplies information about files that were compared (including the comparison mode used, and the path of the compared files). This element occurs only once.

 

Next, all the encountered differences (two, in this example) are listed by means of multiple xml_diff elements. In the context of each difference, the left_location (and right_location, correspondingly) inform you where the difference was encountered, as an XPath expression.  The left_content (and right_content, correspondingly) inform you about the exact element or attribute that is changed.

© 2018-2024 Altova GmbH