@Test public void detects_explicit_schema_declaration_preceded_with_comments() throws Exception { String document = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!-- here is an awesome comment -->\n" + "<changelog xmlns:xsi=\"http: " xsi:noNamespaceSchemaLocation=\"http: "</changelog>"; assertThat(detector.hasExplicitSchema(domSource(document))).isTrue(); }
public boolean hasExplicitSchema(DOMSource changelog) { Node node = changelog.getNode(); if (node.getNodeType() == Node.DOCUMENT_NODE) { return hasExplicitSchema(rootElement(node)); } return hasExplicitSchema(node); }
SchemaDetector { public boolean hasExplicitSchema(DOMSource changelog) { Node node = changelog.getNode(); if (node.getNodeType() == Node.DOCUMENT_NODE) { return hasExplicitSchema(rootElement(node)); } return hasExplicitSchema(node); } }
SchemaDetector { public boolean hasExplicitSchema(DOMSource changelog) { Node node = changelog.getNode(); if (node.getNodeType() == Node.DOCUMENT_NODE) { return hasExplicitSchema(rootElement(node)); } return hasExplicitSchema(node); }  }
SchemaDetector { public boolean hasExplicitSchema(DOMSource changelog) { Node node = changelog.getNode(); if (node.getNodeType() == Node.DOCUMENT_NODE) { return hasExplicitSchema(rootElement(node)); } return hasExplicitSchema(node); }  boolean hasExplicitSchema(DOMSource changelog); }
SchemaDetector { public boolean hasExplicitSchema(DOMSource changelog) { Node node = changelog.getNode(); if (node.getNodeType() == Node.DOCUMENT_NODE) { return hasExplicitSchema(rootElement(node)); } return hasExplicitSchema(node); }  boolean hasExplicitSchema(DOMSource changelog);  }