title: Is there a way to validate an in memory XML DOM Tree in Java?
body: <p>I'm creating an XML document using DocumentBuilderFactory and w3c.org's Document class. I want to validate the resulting structure against an XSD before writing it out to a file.
  I know that I can set the DocumentBuilderFactory to validate as it is being created but I would prefer not to as I am doing other things with it.</p>
  
  <p>Thanks.</p>