Permalink
Browse files

Perform XInclude fallback for unrecognized parse value

  • Loading branch information...
ndw committed Apr 16, 2016
1 parent 7e5e8ee commit bab1f624371015bdaa1400368de4da00e8322c3e
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/main/java/com/xmlcalabash/library/XInclude.java
@@ -195,6 +195,7 @@ public boolean processStartElement(XdmNode node) throws SaxonApiException {
}
}
+ boolean forceFallback = false;
XPointer xpointer = null;
XdmNode subdoc = null;
@@ -211,8 +212,10 @@ public boolean processStartElement(XdmNode node) throws SaxonApiException {
} else if ("text".equals(parse) || parse.startsWith("text/")) {
parse = "text";
} else {
- logger.info("Unrecognized parse value on XInclude: " + parse + " using 'xml' instead.");
- parse = "xml";
+ logger.info("Unrecognized parse value on XInclude: " + parse);
+ xptr = null;
+ fragid = null;
+ forceFallback = true;
}
if (xptr != null && fragid != null) {
@@ -248,7 +251,11 @@ public boolean processStartElement(XdmNode node) throws SaxonApiException {
xpointer = new XPointer(runtime, xptr, readLimit);
}
- if ("text".equals(parse)) {
+ if (forceFallback) {
+ logger.trace(MessageFormatter.nodeMessage(node, "XInclude fallback forced"));
+ fallback(node, href);
+ return false;
+ } else if ("text".equals(parse)) {
readText(href, node, node.getBaseURI().toASCIIString(), xpointer, matcher);
return false;
} else {

0 comments on commit bab1f62

Please sign in to comment.