Created
April 3, 2018 21:34
-
-
Save igor-suhorukov/2caaad972728d6bc80e286654e2cfde7 to your computer and use it in GitHub Desktop.
reuse existing DOM model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Document document = DocumentBuilderFactory.newInstance().newInstance().newDocumentBuilder().parse(new File("pom.xml")); | |
try(QueryProcessor proc = new QueryProcessor("declare variable $mydoc external; $mydoc//node()[text()='Igor Sukhorukov']", context)) { | |
proc.bind("mydoc", document); | |
// Execute the query | |
Value result = proc.value(); | |
// Print result as string. | |
System.out.println(result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment