@Test public void testGetDocComment() { String comment = getDocumentComment(pomDoc); assertEquals(docComment, comment); }
static public String getDocumentComment(Document doc) { String docComment = null; try { NodeList childs = doc.getChildNodes(); for (int i = 0; i < childs.getLength(); i++) { Node child = childs.item(i); if (child.getNodeType() == Node.COMMENT_NODE) { docComment = child.getNodeValue(); } } return docComment; } catch (Exception e) { throw new RuntimeException(e); } }
XPathUtil { static public String getDocumentComment(Document doc) { String docComment = null; try { NodeList childs = doc.getChildNodes(); for (int i = 0; i < childs.getLength(); i++) { Node child = childs.item(i); if (child.getNodeType() == Node.COMMENT_NODE) { docComment = child.getNodeValue(); } } return docComment; } catch (Exception e) { throw new RuntimeException(e); } } }
XPathUtil { static public String getDocumentComment(Document doc) { String docComment = null; try { NodeList childs = doc.getChildNodes(); for (int i = 0; i < childs.getLength(); i++) { Node child = childs.item(i); if (child.getNodeType() == Node.COMMENT_NODE) { docComment = child.getNodeValue(); } } return docComment; } catch (Exception e) { throw new RuntimeException(e); } } private  XPathUtil(); }
XPathUtil { static public String getDocumentComment(Document doc) { String docComment = null; try { NodeList childs = doc.getChildNodes(); for (int i = 0; i < childs.getLength(); i++) { Node child = childs.item(i); if (child.getNodeType() == Node.COMMENT_NODE) { docComment = child.getNodeValue(); } } return docComment; } catch (Exception e) { throw new RuntimeException(e); } } private  XPathUtil(); static Document createDocument(InputStream content); static Document createDocument(String content); static Document createDocument(String content, String charset); static DocumentBuilder getBuilder(); static String getDocumentComment(Document doc); static NodeList getXPathResult(Node node, String namespacePrefix, String namespaceURI, String expression); static NodeList getXPathResult(Node node, Map<String, String> namespaceMap, String expression); static String getFirstValue(NodeList nodes); static List<String> getValues(NodeList nodes); static void appendXmlFragment(Node parent, String fragment); static String getXml(Node node); static String getXml(Node node, boolean indentXml, int indentSize); static XMLGregorianCalendar convertDateToXmlDate(Date date); static String lookupParameterValue(String key, String string); static String normalizeXmlString(String xml); }
XPathUtil { static public String getDocumentComment(Document doc) { String docComment = null; try { NodeList childs = doc.getChildNodes(); for (int i = 0; i < childs.getLength(); i++) { Node child = childs.item(i); if (child.getNodeType() == Node.COMMENT_NODE) { docComment = child.getNodeValue(); } } return docComment; } catch (Exception e) { throw new RuntimeException(e); } } private  XPathUtil(); static Document createDocument(InputStream content); static Document createDocument(String content); static Document createDocument(String content, String charset); static DocumentBuilder getBuilder(); static String getDocumentComment(Document doc); static NodeList getXPathResult(Node node, String namespacePrefix, String namespaceURI, String expression); static NodeList getXPathResult(Node node, Map<String, String> namespaceMap, String expression); static String getFirstValue(NodeList nodes); static List<String> getValues(NodeList nodes); static void appendXmlFragment(Node parent, String fragment); static String getXml(Node node); static String getXml(Node node, boolean indentXml, int indentSize); static XMLGregorianCalendar convertDateToXmlDate(Date date); static String lookupParameterValue(String key, String string); static String normalizeXmlString(String xml);  }