Skip to content

Commit

Permalink
XPath 2.0 date demo
Browse files Browse the repository at this point in the history
  • Loading branch information
plutext committed Jan 2, 2019
1 parent 6b67b05 commit 1bd5f83
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion sample-docs/word/databinding/invoice-data.xml
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -20,4 +22,4 @@
<includeBankDetails>true</includeBankDetails>
<wantspam>false</wantspam>
</misc>
</invoice>
</invoice>
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ public class ContentControlBindingExtensions {
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";


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;



Expand Down Expand Up @@ -79,8 +80,14 @@ public class ContentControlBindingExtensionsOld {
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("."));
Expand Down

0 comments on commit 1bd5f83

Please sign in to comment.