Loading login details...

DeltaXML Support Forums

 new topic  post reply 
moderators: chrisc nigelw tristanm
NonMatchingPCDataCombineException
Joined: 04-July-2008
Posts: 4
Posted: 08-July-2008 20:00
Hi
I was able to create a delta file without problems but when trying to recombine the delta with one of the original files to get a third one I receive the following exception:

com.deltaxml.api.NonMatchingPCDataCombineException: The PCData at /videocollection in the delta file does not match the PCData at /videocollection in the input file.
   at com.deltaxml.c_b.c_cb.c_b(c_cb.java:240)
   at com.deltaxml.api.CombinerImpl.combine(CombinerImpl.java:8)
   at deltaxml.DeltaXMLTest.reverseXML(DeltaXMLTest.java:77)
   at deltaxml.DeltaXMLTest.main(DeltaXMLTest.java:93)

Here are the XML files

a.xml
<videocollection>
  <title>Tootsie</title>
</videocollection>


b.xml
<videocollection>
  <title>Tootsie 2</title>
</videocollection>


Any idea?
Recombined Deltas must be 'raw'
Joined: 27-March-2007
Posts: 42
Location: Malvern, United Kingdom
Posted: 09-July-2008 12:11
Hello Giovani,

Without seeing the delta input to the recombine operation it is hard to give a definitive answer to this problem.  However,   I can make an educated guess:  there is a good chance that your delta input to the combine operation has been modified in some way.

The recombine operation requires 'raw' delta files, and in particular you should not:
* Indent the output delta ("Indent=yes" on the command-line)
* Remove whitespace with the NormalizeSpace filter prior to comparison
   (add "Preserve Whitespace=true" to the command-line tools).

We added these options to various comparison pipelines because they provide flexibility for users doing various types of comparison operation and post-processing, however they do not play well with the recombination operations.

If you are familar with the UNIX command-line tools diff and patch, this would be similar to reformatting a diff output file and then expecting patch to operate on it.

We document this, for the command-line tools in the release and online at:
  http://www.deltaxml.com/core/5.0/docs/command-processor.html#commands

From the exception stack-trace I see that you are using the API.  You may have noticed that there isn't a PipelinedCombiner as pipelining the combine operation doesn't make sense (there are no useful input or output filters that can be applied).  In general if you are using the com.deltaxml.api.XMLCombiner it makes sense to  also use the comparator from the same package, the com.deltaxml.api.XMLComparator.

I think we need to make our documentation clearer on these aspects of the Combiner API usage (similar to the command-line documentation) and we will do this
for our 5.1 release.

Thanks for the feedback and apologies for any confusion this has caused.

Nigel
Joined: 04-July-2008
Posts: 4
Posted: 09-July-2008 13:44
Hello

thank you for the reply. My delta file has not been modified
by any other process.
Not sure what is wrong. I also would like to say that I followed the same steps in the tutorial, using the same XML files and the same error happens.

Below is the java code and delta file. I keep receiving the same exception.
I appreciate your help.

Java Code:

public class DeltaXMLTest {

    static String FILE1 = "C:/Java/XML/a.xml";
    static String FILE2 = "C:/Java/XML/b.xml";
    static String DELTA = "C:/Java/XML/deltaxml.xml";
    static String COMBINED = "C:/Java/XML/combined.xml";
   
    public void generateDelta(){
       
        try {
            PipelinedComparator pc= new PipelinedComparator();
            //pc.setOutputProperty(OutputKeys.INDENT, "yes");
            //pc.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
            pc.compare(new File(FILE1),
                    new File(FILE2), new File(DELTA));
           
        //} catch (PropertyNotRecognizedException e) {
          //  e.printStackTrace();
        } catch (ParserInstantiationException e) {
            e.printStackTrace();
        } catch (TransformerInstantiationException e) {
            e.printStackTrace();
        } catch (PipelineProcessingException e) {
            e.printStackTrace();
        } catch (IdentityTransformerSetupException e) {
            e.printStackTrace();
        } catch (ComparatorInstantiationException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        }
    }
   
    public void reverseXML(){
        try {
            XMLCombiner combiner = XMLCombinerFactory.newInstance().newXMLCombiner();
            try {
                PipelinedComparator pc= new PipelinedComparator();
                System.out.println(pc.isEqual(new File(FILE2), new File(FILE1)));
            } catch (ParserInstantiationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (TransformerInstantiationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (PipelineProcessingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ComparatorInstantiationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
           
            combiner.combine(new StreamSource(new File(FILE2)),
                             new StreamSource(new File(DELTA)),
                             new StreamResult(new File(COMBINED)));
           
        } catch (XMLCombinerConfigurationException e) {
            e.printStackTrace();
        } catch (XMLCombinerFactoryConfigurationError e) {
            e.printStackTrace();
        } catch (DeltaXMLProcessingException e) {
            e.printStackTrace();
        }         
    }
   
    public static void main(String[] args) {
        DeltaXMLTest delta = new DeltaXMLTest();
        delta.generateDelta();
        delta.reverseXML();
    }
}


Delta File
Joined: 04-July-2008
Posts: 4
Posted: 09-July-2008 13:46
Not sure why the delta didn't display here. Trying to post it again (removing now the xml version tag).

Joined: 04-July-2008
Posts: 4
Posted: 09-July-2008 13:47
Quoting the delta.
Here you go.

<?xml version="1.0" encoding="UTF-8" standalone="no"?><videocollection xmlns:deltaxml="http://www.deltaxml.com/ns/well-formed-delta-v1" xmlns:dxx="http://www.deltaxml.com/ns/xml-namespaced-attribute" xmlns:dxa="http://www.deltaxml.com/ns/non-namespaced-attribute" deltaxml:deltaV2="A!=B" deltaxml:version="2.0" deltaxml:content-type="changes-only">
   <title deltaxml:deltaV2="A!=B"><deltaxml:textGroup deltaxml:deltaV2="A!=B"><deltaxml:text deltaxml:deltaV2="A">Tootsie</deltaxml:text><deltaxml:text deltaxml:deltaV2="B">Tootsie 2</deltaxml:text></deltaxml:textGroup></title>
</videocollection>
Delta files are asymmetric
Joined: 27-March-2007
Posts: 42
Location: Malvern, United Kingdom
Posted: 09-July-2008 15:17
Hi Giovani,

Thanks for the code, I think I've finally spotted the problem:  A delta file is not symmetric; the combine operation has a direction which must correspond to the direction (order of input files/streams) in the comparison operation. 

In summary:

  a.xml compare b.xml -> ab.xml  (ab.xml is the delta)
  a.xml combine ab.xml -> b.xml
  b.xml reverse-combine ab.xml -> a.xml

The reverse combination is controlled via a feature setting:

http://www.deltaxml.com/core/5.0/docs/api/com/deltaxml/api/package-summary.html#features

I took your code and made it work on my system.  As well as changing the parameters to the combine I also had to:

* change some of the filepaths to avoid c: (I was using Unix rather than Windows)
* Change one of the StreamResults - for reasons I don't completely understand yet.

Here is the code and the command-lines used to compile
and run:

import com.deltaxml.api.DeltaXMLProcessingException;
import com.deltaxml.api.XMLCombiner;
import com.deltaxml.api.XMLCombinerConfigurationException;
import com.deltaxml.api.XMLCombinerFactory;
import com.deltaxml.api.XMLCombinerFactoryConfigurationError;
import com.deltaxml.core.ComparatorInstantiationException;
import com.deltaxml.core.IdentityTransformerSetupException;
import com.deltaxml.core.ParserInstantiationException;
import com.deltaxml.core.PipelineProcessingException;
import com.deltaxml.core.PipelinedComparator;
import com.deltaxml.core.PipelinedComparatorException;
import com.deltaxml.core.PropertyNotRecognizedException;
import com.deltaxml.core.TransformerInstantiationException;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.FileNotFoundException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;


public class DeltaXMLTest {

    static String FILE1 = "a.xml";
    static String FILE2 = "b.xml";
    static String DELTA = "deltaxml.xml";
    static String COMBINED = "combined.xml";
   
    public void generateDelta(){
       
        try {
            PipelinedComparator pc= new PipelinedComparator();
            //pc.setOutputProperty(OutputKeys.INDENT, "yes");
            //pc.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
            pc.compare(new File(FILE1),
                    new File(FILE2), new File(DELTA));
           
        //} catch (PropertyNotRecognizedException e) {
          //  e.printStackTrace();
        } catch (ParserInstantiationException e) {
            e.printStackTrace();
        } catch (TransformerInstantiationException e) {
            e.printStackTrace();
        } catch (PipelineProcessingException e) {
            e.printStackTrace();
        } catch (IdentityTransformerSetupException e) {
            e.printStackTrace();
        } catch (ComparatorInstantiationException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        }
    }
   
    public void reverseXML(){
        try {
            XMLCombiner combiner = XMLCombinerFactory.newInstance().newXMLCombiner();
            try {
                PipelinedComparator pc= new PipelinedComparator();
                System.out.println(pc.isEqual(new File(FILE2), new File(FILE1)));
            } catch (ParserInstantiationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (TransformerInstantiationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (PipelineProcessingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ComparatorInstantiationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
           
            combiner.combine(new StreamSource(new File(FILE1)),
                             new StreamSource(new File(DELTA)),
                             new StreamResult(new FileWriter(COMBINED)));
           
        } catch (XMLCombinerConfigurationException e) {
            e.printStackTrace();
        } catch (XMLCombinerFactoryConfigurationError e) {
            e.printStackTrace();
        } catch (DeltaXMLProcessingException e) {
            e.printStackTrace();
        } catch (IOException e) {
          e.printStackTrace();
        }         
    }
   
    public static void main(String[] args) {
        DeltaXMLTest delta = new DeltaXMLTest();
        delta.generateDelta();
        delta.reverseXML();
    }
}


Here are the command-lines I used on my Macbook - on Windows they will be similar but you may need to replace : with ; in  the classpaths.  I copied all of the .jar file from our 5.0 release into this test directory.

/tmp/giovani $ java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)
/tmp/giovani $
/tmp/giovani $
/tmp/giovani $
/tmp/giovani $ javac -cp deltaxml.jar DeltaXMLTest.java
/tmp/giovani $ java -cp saxon9.jar:deltaxml.jar:. DeltaXMLTest
false
/tmp/giovani $ ls -l *.xml
-rw-r--r--@ 1 nigelw  wheel   35 Jul  9 12:53 a.xml
-rw-r--r--@ 1 nigelw  wheel   58 Jul  9 12:54 b.xml
-rw-r--r--  1 nigelw  wheel  842 Jul  9 15:08 combined.xml
-rw-r--r--  1 nigelw  wheel  653 Jul  9 15:08 deltaxml.xml
/tmp/giovani $
 new topic  post reply  To find out about new replies to this post as they occur
please subscribe to one of these feeds:
AtomRSS moderate