Menu

CDATA comparisson

2009-02-22
2013-03-03
  • Hernan Leoni

    Hernan Leoni - 2009-02-22

    I have a question regarding CDATA comparisson.

    I'm trying to compare these two texts, which are inside CDATA elements in my xml.

    'My test page's title'

    'My test page's title'

    XMLUnit gives

    [different] Expected text value 'My test page's title' but was 'My test page's title' - comparing

    I have set

        XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
        XMLUnit.setExpandEntityReferences(true);

    but nothing happened,

    is there any way to try these two texts as equals?

    Thanks

    Hernan

     
    • Stefan Bodewig

      Stefan Bodewig - 2009-02-23

      what you see is what the XML parser hands to XMLUnit.

      & inside a CDATA section is not an entity that gets expanded, it remains a literal & - and so
      <![CDATA[&#039;s]]> is quite different from a single quote.  Your two CDATA section really are not identical or the same or anywhere close to it.

       

Log in to post a comment.

MongoDB Logo MongoDB