Skip to content

Commit 1bd5f83

Browse files
committed
XPath 2.0 date demo
1 parent 6b67b05 commit 1bd5f83

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

sample-docs/word/databinding/invoice-data.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><invoice>
2+
3+
<date>2019-01-15</date>
24
<customer>
35
<name>Joe Bloggs</name>
46
</customer>
@@ -20,4 +22,4 @@
2022
<includeBankDetails>true</includeBankDetails>
2123
<wantspam>false</wantspam>
2224
</misc>
23-
</invoice>
25+
</invoice>
28.8 KB
Binary file not shown.

src/samples/docx4j/org/docx4j/samples/ContentControlBindingExtensions.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ public class ContentControlBindingExtensions {
7272
public static void main(String[] args) throws Exception {
7373

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

7777
String input_DOCX = System.getProperty("user.dir") + "/sample-docs/word/databinding/invoice.docx";
78+
// String input_DOCX = System.getProperty("user.dir") + "/sample-docs/word/databinding/invoice_Saxon_XPath2.docx";
79+
7880
String input_XML = System.getProperty("user.dir") + "/sample-docs/word/databinding/invoice-data.xml";
7981

8082

src/samples/docx4j/org/docx4j/samples/ContentControlBindingExtensionsOld.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.docx4j.openpackaging.exceptions.Docx4JException;
4747
import org.docx4j.openpackaging.io.SaveToZipFile;
4848
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
49+
import org.docx4j.utils.XPathFactoryUtil;
4950

5051

5152

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

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

86+
// Without Saxon, you are restricted to XPath 1.0
87+
boolean USE_SAXON = true; // set this to true; add Saxon to your classpath, and uncomment below
88+
// if (USE_SAXON) XPathFactoryUtil.setxPathFactory(
89+
// new net.sf.saxon.xpath.XPathFactoryImpl());
90+
8491
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));
8592

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

0 commit comments

Comments
 (0)