Can also compare two java.io.Reader objects
  whose content will be parsed
  
  public void testHelloWorld3() 
    throws SAXException, IOException, ParserConfigurationException {
   
    Reader in1 = new InputStreamReader(new FileInputStream("hello1.xml"), "UTF-8");
    Reader in2 = new InputStreamReader(new FileInputStream("hello2.xml"), "UTF-8");
    assertXMLEqual(in1, in2);
    
  }This is poor design. Readers do not handle XML encoding properly. Do not use these methods.
Instead compare DOM documents:
  public void testHelloWorld4() 
    throws SAXException, IOException, ParserConfigurationException {
   
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true); // NEVER FORGET THIS!
    DocumentBuilder builder = factory.newDocumentBuilder();
    
    Document in1 = builder.parse(new File("hello1.xml"));
    Document in2 = builder.parse(new File("hello2.xml"));
    assertXMLEqual(in1, in2);
    
  }