Merging Tables
Merge supports table-aware merge processing for both HTML and CALS table formats. Table-aware processing aligns table rows and cells intelligently rather than treating them as generic XML elements.
Enabling Table Processing
Table processing is enabled via the cal-table-processing or html-table-processing parameters:
java -jar deltanova-year.x.y.z.jar merge concurrent \
ancestor ancestor.xml anna anna.xml ben ben.xml result.xml \
cals-table-processing=true
In the Java API:
ConcurrentMerge merge = new ConcurrentMerge();
merge.getCalsTableConfiguration().setProcessTables(true);
In the configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="com.deltaxml.merge.rest.config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="merge-configuration.xsd">
<concurrentMerge>
<calsTableConfiguration>
<processTables>true</processTables>
<invalidTableBehaviour>compareAsXml</invalidTableBehaviour>
<warningReportMode>comments</warningReportMode>
<validationLevel>strict</validationLevel>
</calsTableConfiguration>
<htmlTableConfiguration>
<processTables>true</processTables>
<invalidTableBehaviour>compareAsXml</invalidTableBehaviour>
<warningReportMode>comments</warningReportMode>
<validationLevel>strict</validationLevel>
<normalizeTable>false</normalizeTable>
</htmlTableConfiguration>
</concurrentMerge>
</configuration>
HTML Tables
HTML tables (<table>, <tr>, <td>, <th>) are detected automatically when html-table-processing=true.
CALS Tables
CALS tables (used in DocBook and DITA) are also detected automatically. Additional parameters control CALS table validation:
invalid-table-behaviour
|
Value |
Description |
|---|---|
|
|
Propagate changes to the |
|
|
Compare invalid CALS tables as plain XML |
|
|
Throw an exception when invalid CALS tables are encountered |
validation-level
|
Value |
Description |
|---|---|
|
|
Invalidities known to have no effect on processing do not cause bypass |
|
|
All invalidities cause the appropriate processing to be bypassed |
warning-report-mode
|
Value |
Description |
|---|---|
|
|
Report warnings as |
|
|
Report warnings as XML comments |
|
|
Report warnings using |
Example
Given ancestor.xml:
<table>
<tr><td>Name</td><td>Value</td></tr>
<tr><td>Alpha</td><td>1</td></tr>
</table>
Anna adds a row, Ben modifies a value. With html-table-processing=true, the merge output correctly identifies the row addition and cell modification as separate changes rather than conflating them.