Loading login details...

DeltaXML Support Forums

Not found what you where looking for? Try the  advanced search 
DeltaXML Core > Determining if documents are equivalent with PipelinedComparator?
Joined: 07-April-2008
Posts: 1
Location: Edinburgh, Australia
Posted: 04-April-2008 007:20
Determining if documents are equivalent with PipelinedComparator?
Can I determine if two filtered XML documents are equivelent using PipelinedComparator?

PipelinedComparator doesn't appear to have an equivalent to the isEqual() method of XMLComparator and parsing the output file seems rather extreme.
DeltaXML Core > Getting error with sample AddressBook using xsd instead
Joined: 03-March-2008
Posts: 2
Location: Marietta, United States of America
Posted: 03-March-2008 19:18
Hi Nigel,

Setting pc.setParserFeature("http://apache.org/xml/features/validation/schema", true); did the trick.

There's already a schema tag in the xsd file.  It must somehow gotten removed in the process of pasting/editing on my part.

Thank you
DeltaXML Core > Getting error with sample AddressBook using xsd instead
Joined: 27-March-2007
Posts: 42
Location: Malvern, United Kingdom
Posted: 03-March-2008 15:29
Hello there,

I've just downloaded  DeltaXMLCore-4_5_1 to evaluate.  I'm poking around with Addressbook example to use xsd instead of dtd.  I'm getting the following error when execute AddressBook.  However, running the files through DeltaWing and it works fine.  Can someone please point out what I'm doing wrong?  Thank you.


Your requirement seems perfectly reasonable, but it is something that we haven't got around to creating an example for yet.

First off this exception message isn't very informative!  When the data files (a1.xml/a2.xml) are not well-formed a more informative messages indicating the nature of the failure is coming out in the exception trace.  It appears to be an issue with how the exception is passed from the parser through the input filter chain when Saxon is being used.

When I tried to run the code I discovered a missing line in the xsd, it needs an opening schema tag and namespace declaration:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">


Because the error message was unhelpful I used the standalone sax.Counter sample to test the files/schema, with a command-line like this:

java -cp /usr/local/java/xerces-2_9_0/xercesImpl.jar:/usr/local/java/xerces-2_9_0/xercesSamples.jar sax.Counter  -v -s -f a1.xml


I also modifed the data files, for example:

<addressList xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xsi:noNamespaceSchemaLocation='address.xsd'>
   <person customerid="15">


I'm not too sure as to why it worked in DeltaWing and not in the sample.  One possibility is that somehow different versions of the SAX Parser and XSLT processors were being used, caused by some slight difference in the classpath or the JVM.  This is an area where different JVMs 1.4, 5.0, 6.0 have different behaviours (because of the changes in the Xerces/Xalan components and their package locations included in the Java runtime) and we usually need more information to debug.

Two other probably related issues....

You may need:

pc.setParserFeature("http://apache.org/xml/features/validation/schema", true);


Finally, if you need more explicit control of the parsers being used you can always instantiate them yourself (you need 2, one for each input) using the JAXP factory, configure as needed and then hook them into the PipelinedComparator using SAXSource inputs.

Hope this helps,

Nigel

DeltaXML Core > Getting error with sample AddressBook using xsd instead
Joined: 03-March-2008
Posts: 2
Location: Marietta, United States of America
Posted: 03-March-2008 12:55
Getting error with sample AddressBook using xsd instead
I've just downloaded  DeltaXMLCore-4_5_1 to evaluate.  I'm poking around with Addressbook example to use xsd instead of dtd.  I'm getting the following error when execute AddressBook.  However, running the files through DeltaWing and it works fine.  Can someone please point out what I'm doing wrong?  Thank you.

run:
     [java] Exception in thread "main" com.deltaxml.core.PipelineProcessingExcep
tion: Exception detected during pipeline processing
     [java]     at com.deltaxml.core.PipelinedComparator.compare(PipelinedComparator.java:74)
     [java]     at com.deltaxml.core.PipelinedComparator.compare(PipelinedComparator.java:302)
     [java]     at AddressBook.main(AddressBook.java:43)
     [java] Caused by: com.deltaxml.api.DeltaXMLProcessingException: XML Parsing failed
     [java]     at com.deltaxml.c_b.c_a.c_g.c_a(c_g.java:121)
     [java]     at com.deltaxml.api.ComparatorImpl.c_a(ComparatorImpl.java:60)
     [java]     at com.deltaxml.api.ComparatorImpl.compare(ComparatorImpl.java:27)
     [java]     at com.deltaxml.core.PipelinedComparator.compare(PipelinedComparator.java:306)
     [java]     ... 2 more
     [java] Caused by: javax.xml.transform.TransformerException: XML Parsing failed
     [java]     at com.icl.saxon.Filter.parse(Filter.java:412)
     [java]     at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)
     [java]     at com.deltaxml.c_b.c_a.c_g.c_a(c_g.java:110)
     [java]     ... 5 more
     [java] Java Result: 1
     [echo] Running: AddressBook on (a1.xml, a2.xml) to produce out.html

Schema I created:

<?xml version="1.0" encoding="ISO-8859-1" ?>


<xs:simpleType name="stringtype">
<xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="personidtype">
<xs:restriction base="xs:string">
  <xs:pattern value="[0-9]{2,5}"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="addresstype">
<xs:sequence>
  <xs:element name="line" type="stringtype" maxOccurs="2"/>
  <xs:element name="zip" type="stringtype"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="persontype">
<xs:sequence>
  <xs:element name="name" type="stringtype"/>
  <xs:element name="email" type="stringtype"/>
  <xs:element name="address" type="addresstype"/>
</xs:sequence>
<xs:attribute name="customerid" type="personidtype" use="required"/>
</xs:complexType>

<xs:complexType name="addressListtype">
  <xs:sequence>
    <xs:element name="person" type="persontype" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

<xs:element name="addressList" type="addressListtype"/>

</xs:schema>
DeltaXML Core > Auto Feed XML Compare?
Joined: 28-March-2007
Posts: 14
Location: Salisbury, UK
Posted: 02-February-2008 11:04
Re: Auto Feed XML Compare?
Hi,
firstly, let me apologise for this reply taking so long. Your post was not spotted as quickly as it should have been.

I'm not entirely certain what you are trying to achieve here. Are you trying to compare a single document against n other documents or are you trying to set up multiple pairs of documents for comparison?

At present, our api only supports a single comparison between two files. However, if you could clarify what you are trying to do, we will make some more useful suggestions as to how to achieve it.

Many thanks,

Tristan
DeltaXML Core > Auto Feed XML Compare?
Joined: 20-February-2008
Posts: 1
Posted: 02-February-2008 21:05
Auto Feed XML Compare?
Does the core product support the auto feed of multiple XML documents to be compared?  Or can only two XML files be compared at a time?
DeltaXML Core > setting features with core 4.4
Joined: 27-March-2007
Posts: 42
Location: Malvern, United Kingdom
Posted: 01-January-2008 16:43
Re: compator vs combiner features
Hello Robert,

do i get you right?

the combiner is used to reproduce a source document?
so when i compare A and B and get the result C, then i can take B and C to get A again?


Yes, exactly.

A compare B -> C  ; A combine-forward C -> B
                     B combine-reverse C -> A

Note that comparison is not commutative, so that:
  A compare B != B compare A

Similarly this all works the other way round, so that:

  B compare A -> D  ; B combine-forward D -> A
                      A combine-reverse D -> B

So the compareForward feature allows you to reverse the normal 'direction' of the delta when used with recombination.

We don't believe we have many users of the combiner - though it does have some specialized use-cases, but it is an important way to prove the correctness of the delta; we use it heavily in our test processes.
DeltaXML Core > setting features with core 4.4
Joined: 25-October-2007
Posts: 2
Posted: 01-January-2008 12:33
compator vs combiner features
hello nigel

thanks for your fast reply.

do i get you right?

the combiner is used to reproduce a source document?
so when i compare A and B and get the result C, then i can take B and C to get A again?

regards
robert
DeltaXML Core > setting features with core 4.4
Joined: 27-March-2007
Posts: 42
Location: Malvern, United Kingdom
Posted: 01-January-2008 14:46
compator vs combiner features
Hello Robert,

The PipelinedComparator comparator feature: http://deltaxml.com/api/feature/isCombineForward is not recognized


This is because isCombineForward is a combiner feature, not a comparator feature.

The combiner is a component which takes a raw, changes-only or minimal delta produced by the comparator and one of the other comparator inputs and a regenerate or 'recombine' to produce what was the other comparator input.

What does this mean?
With the isFullDelta, enhancedMatch1 and enhancedMatch2 features its working fine. For all for I use the method setComparatorFeature(featureName, featureValue)

So can anyone tell me what I'm doing wrong?


The software is working as we expect, I think you may have seen the list of features and did not appreciate the distinction between comparator and combiner?  I'll see if there is anything in the documentation we can improve for a future release.

Some backround to the API design:  There is both an XMLComparator and an XMLCombiner in the lower level JAXP style API (in the com.deltaxml.api package).  But there is only a PipelinedComparator in the higher level com.deltaxml.core API.   The reason that we don't have a PipelinedCombiner is because when the comparator/combiner are used to 'round-trip' XML, the combiner needs raw un-processed delta files from the comparator.  We have many use-cases for a Pipelined Comparator, but we could not find any for a 'Pipelined Combiner',  hence the differences in these APIs.

Regards,

Nigel
DeltaXML Core > setting features with core 4.4
Joined: 25-October-2007
Posts: 2
Posted: 01-January-2008 12:34
setting features with core 4.4
Hello,

I was trying to use some special features of the 4.4 API, but there I got some problems. When I try to set the isCombineForward feature I always get the same exception

The PipelinedComparator comparator feature: http://deltaxml.com/api/feature/isCombineForward is not recognized

What does this mean?
With the isFullDelta, enhancedMatch1 and enhancedMatch2 features its working fine. For all for I use the method setComparatorFeature(featureName, featureValue)

So can anyone tell me what I'm doing wrong?

reguards
Robert