Co-authored-by: Adam Bem <adam.bem@zoho.eu> Reviewed-on: R11/release11-tools-web#95
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.r11.tools.xml;
|
package com.r11.tools.xml;
|
||||||
|
|
||||||
import org.apache.xpath.XPathAPI;
|
import org.apache.xpath.XPathAPI;
|
||||||
|
import org.apache.xpath.objects.XObject;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.traversal.NodeIterator;
|
import org.w3c.dom.traversal.NodeIterator;
|
||||||
@@ -76,6 +77,7 @@ public class Xalan {
|
|||||||
serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
|
serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
|
||||||
|
|
||||||
// Use the simple XPath API to select a nodeIterator.
|
// Use the simple XPath API to select a nodeIterator.
|
||||||
|
try {
|
||||||
NodeIterator nl = XPathAPI.selectNodeIterator(doc, transform);
|
NodeIterator nl = XPathAPI.selectNodeIterator(doc, transform);
|
||||||
|
|
||||||
// Serialize the found nodes to result object.
|
// Serialize the found nodes to result object.
|
||||||
@@ -98,6 +100,10 @@ public class Xalan {
|
|||||||
result.append("\n");
|
result.append("\n");
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
|
} catch (TransformerException e) {
|
||||||
|
return XPathAPI.eval(doc, transform).toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user