Some documents that are equal but not identical

These tests all pass:

  public void testSiblingOrder() 
    throws SAXException, IOException, ParserConfigurationException {
    
    String expected = "<a><x/><y/></a>";
    String actual = "<a><y/><x/></a>";
    assertXMLEqual("Sibling order seems to count", expected, actual);
    
  }

  public void testNamespacePrefix() 
    throws SAXException, IOException, ParserConfigurationException {
    
    String expected = "<a xmlns='http://www.example.org'><x/></a>";
    String actual = "<pre:a xmlns:pre='http://www.example.org'><pre:x/></pre:a>";
    assertXMLEqual(expected, actual);
    
  }
  
  public void testDOCTYPE() 
    throws SAXException, IOException, ParserConfigurationException {
    
    String expected = "<!DOCTYPE a [<!ATTLIST a b CDATA 'test'>]>\n" +
      "<a><x/></a>";
    String actual = "<a b='test'><x/></a>";
    assertXMLEqual(expected, actual);
    
  }
  
  public void testCommentInProlog() 
    throws SAXException, IOException, ParserConfigurationException {
    
    String expected = "<!-- test -->" +
      "<a><x/></a>";
    String actual = "<a><x/></a>";
    assertXMLEqual(expected, actual);
    
  }

  public void testProcessingInstructionInProlog() 
    throws SAXException, IOException, ParserConfigurationException {
    
    String expected = "<?xml-styleshet type='text/css' href='file.css'?>" +
      "<a><x/></a>";
    String actual = "<a><x/></a>";
    assertXMLEqual(expected, actual);
    
  }

Previous | Next | Top | Cafe con Leche

Copyright 2005-2007 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified August 17, 2005