File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed
main/java/ru/javaops/masterjava/xml/util
test/java/ru/javaops/masterjava/xml/util Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ public class XPathProcessor {
2222 private static final XPath XPATH = XPATH_FACTORY .newXPath ();
2323
2424 static {
25- DOCUMENT_FACTORY .setNamespaceAware (true );
25+ DOCUMENT_FACTORY .setNamespaceAware (false );
2626 try {
2727 DOCUMENT_BUILDER = DOCUMENT_FACTORY .newDocumentBuilder ();
2828 } catch (ParserConfigurationException e ) {
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public void getCities() throws Exception {
1616 Resources .getResource ("payload.xml" ).openStream ()) {
1717 XPathProcessor processor = new XPathProcessor (is );
1818 XPathExpression expression =
19- XPathProcessor .getExpression ("/*[name()=' Payload']/*[name()=' Cities']/*[name()=' City'] /text()" );
19+ XPathProcessor .getExpression ("/Payload/ Cities/ City/text()" );
2020 NodeList nodes = processor .evaluate (expression , XPathConstants .NODESET );
2121 IntStream .range (0 , nodes .getLength ()).forEach (
2222 i -> System .out .println (nodes .item (i ).getNodeValue ())
You can’t perform that action at this time.
0 commit comments