[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: what is the meaning of similar in xmlUnit


the meaning of similar

On 4 Aug 2005, at 14:48, Li Yuejiong(John) wrote:

> Hi,
>
> In xmlUnit calss XmlTestCase, there are functions named assertXMLEqual
> which assert that two XML documents are similar. According the
> description of function similar in class Diff, "two documents are
> considered to be "similar" if they contain the same elements and
> attributes regardless of order. "
>
> I construct two xml files,
> ============================
> <?xml version="1.0"?>
> <xbrl>
>   <context id="Current_AsOf"/>
>   <context id="Current_ForPeriod"/>
> </xbrl>
> ============================
> <?xml version="1.0"?>
> <xbrl>
>   <context id="Current_ForPeriod"/>
>   <context id="Current_AsOf"/>
> </xbrl>
> ============================
>
> In my application, these two xml files are equal. But when I try to
> similar them as below, I alwayse get the error message "[different]
> Expected attribute value 'Current_AsOf' but was 'Current_ForPeriod' -
> comparing <context id="Current_AsOf"...>"
>
>

[ ... ]

> What's wrong? Is there any way two compare these two files as equal?

I suspect this could be a bug. Have you tried something like this:

============================
<?xml version="1.0"?>
<xbrl>
   <context id="Current_AsOf"/>
   <blah id="Current_ForPeriod"/>
</xbrl>
============================
<?xml version="1.0"?>
<xbrl>
   <blah id="Current_ForPeriod"/>
   <context id="Current_AsOf"/>
</xbrl>
============================

Perhaps XMLUnit only ignores sibling order if the sibling element names 
are different?
If it it still doesn't work you could try canonicalising the XML before 
passing to XMLUnit (e.g. through an XSLT sorting transform). However, 
that may defeat the point, if you are trying to get XMLUnit to do that 
sort of thing.

Btw, I'm not sure why you are asking this on xml-dev. Does XMLUnit not 
have a mailing list?

-- 
dahdah didi dahdidah di http://www.houseofmoran.com/blog/


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.