private ComparisonState compareDocuments ( final Document control , final XPathContext controlContext , final Document test , final XPathContext testContext ) { final DocumentType controlDt = filterNode ( control . getDoctype ( ) ) ; final DocumentType testDt = filterNode ( test . getDoctype ( ) ) ; return compare ( new Comparison ( ComparisonType . HAS_DOCTYPE_DECLARATION , control , getXPath ( controlContext ) , Boolean . valueOf ( controlDt != null ) , getParentXPath ( controlContext ) , test , getXPath ( testContext ) , Boolean . valueOf ( testDt != null ) , getParentXPath ( testContext ) ) ) . andIfTrueThen ( controlDt != null && testDt != null , new DeferredComparison ( ) { @ Override public ComparisonState apply ( ) { return compareNodes ( controlDt , controlContext , testDt , testContext ) ; } } ) . andThen ( compareDeclarations ( control , controlContext , test , testContext ) ) ; }
Compares document node doctype and XML declaration properties