Working on JAXP 1.4 support.
This commit is contained in:
@@ -29,14 +29,15 @@ import javax.xml.xpath.XPathConstants;
|
|||||||
import javax.xml.xpath.XPathFactory;
|
import javax.xml.xpath.XPathFactory;
|
||||||
import javax.xml.xpath.XPathFactoryConfigurationException;
|
import javax.xml.xpath.XPathFactoryConfigurationException;
|
||||||
|
|
||||||
import org.springframework.xml.namespace.SimpleNamespaceContext;
|
|
||||||
import org.springframework.xml.transform.StaxSource;
|
|
||||||
import org.w3c.dom.DOMException;
|
import org.w3c.dom.DOMException;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
|
|
||||||
|
import org.springframework.xml.namespace.SimpleNamespaceContext;
|
||||||
|
import org.springframework.xml.transform.TraxUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of {@link XPathOperations} that uses JAXP 1.3. JAXP 1.3 is part of Java SE since 1.5.
|
* Implementation of {@link XPathOperations} that uses JAXP 1.3. JAXP 1.3 is part of Java SE since 1.5.
|
||||||
* <p/>
|
* <p/>
|
||||||
@@ -127,8 +128,7 @@ public class Jaxp13XPathTemplate extends AbstractXPathTemplate {
|
|||||||
xpath.setNamespaceContext(namespaceContext);
|
xpath.setNamespaceContext(namespaceContext);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (context instanceof StaxSource) {
|
if (TraxUtils.isStaxSource(context)) {
|
||||||
// StaxSource is a subclass of SAXSource, but it has no InputSource, therefore we handle it differently
|
|
||||||
Element element = getRootElement(context);
|
Element element = getRootElement(context);
|
||||||
return xpath.evaluate(expression, element, returnType);
|
return xpath.evaluate(expression, element, returnType);
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ public class Jaxp13XPathTemplate extends AbstractXPathTemplate {
|
|||||||
}
|
}
|
||||||
else if (context instanceof StreamSource) {
|
else if (context instanceof StreamSource) {
|
||||||
StreamSource streamSource = (StreamSource) context;
|
StreamSource streamSource = (StreamSource) context;
|
||||||
InputSource inputSource = null;
|
InputSource inputSource;
|
||||||
if (streamSource.getInputStream() != null) {
|
if (streamSource.getInputStream() != null) {
|
||||||
inputSource = new InputSource(streamSource.getInputStream());
|
inputSource = new InputSource(streamSource.getInputStream());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user