Permalink
Browse files

XPath 2.0 date demo

  • Loading branch information...
plutext committed Jan 2, 2019
1 parent 6b67b05 commit 1bd5f8375525c2f3f22eef33077b593379391b77
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><invoice>

<date>2019-01-15</date>
<customer>
<name>Joe Bloggs</name>
</customer>
@@ -20,4 +22,4 @@
<includeBankDetails>true</includeBankDetails>
<wantspam>false</wantspam>
</misc>
</invoice>
</invoice>
Binary file not shown.
@@ -72,9 +72,11 @@
public static void main(String[] args) throws Exception {

// Without Saxon, you are restricted to XPath 1.0
boolean USE_SAXON = false; // set this to true; add Saxon to your classpath, and uncomment below
boolean USE_SAXON = true; // set this to true; add Saxon to your classpath, and uncomment below

String input_DOCX = System.getProperty("user.dir") + "/sample-docs/word/databinding/invoice.docx";
// String input_DOCX = System.getProperty("user.dir") + "/sample-docs/word/databinding/invoice_Saxon_XPath2.docx";

String input_XML = System.getProperty("user.dir") + "/sample-docs/word/databinding/invoice-data.xml";


@@ -46,6 +46,7 @@
import org.docx4j.openpackaging.exceptions.Docx4JException;
import org.docx4j.openpackaging.io.SaveToZipFile;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.utils.XPathFactoryUtil;



@@ -79,8 +80,14 @@
public static void main(String[] args) throws Exception {

String inputfilepath = System.getProperty("user.dir") + "/sample-docs/word/databinding/invoice.docx";
// String inputfilepath = System.getProperty("user.dir") + "/sample-docs/word/databinding/invoice_Saxon_XPath2.docx";
// String inputfilepath = System.getProperty("user.dir") + "/sample-docs/word/databinding/CountryRegions.xml";

// Without Saxon, you are restricted to XPath 1.0
boolean USE_SAXON = true; // set this to true; add Saxon to your classpath, and uncomment below
// if (USE_SAXON) XPathFactoryUtil.setxPathFactory(
// new net.sf.saxon.xpath.XPathFactoryImpl());

WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));

filepathprefix = inputfilepath.substring(0, inputfilepath.lastIndexOf("."));

0 comments on commit 1bd5f83

Please sign in to comment.