Removed unused code
This commit is contained in:
@@ -65,27 +65,12 @@ public class Xalan {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Process xpath and return either node or wrapped atomic value
|
* Process xpath and return either node or wrapped atomic value
|
||||||
* @deprecated
|
|
||||||
* Xalan needs assumption of the outcome, which is not implemented. Therefore method is deprecated
|
|
||||||
* @param data xml
|
* @param data xml
|
||||||
* @param transform xpath
|
* @param transform xpath
|
||||||
* @return xml processed using given xpath
|
* @return xml processed using given xpath
|
||||||
* @throws Exception thrown on node building errors or invalid xpath
|
* @throws Exception thrown on node building errors or invalid xpath
|
||||||
*/
|
*/
|
||||||
public static String processXPath(String data, String transform) throws Exception {
|
public static String processXPath(String data, String transform) throws Exception {
|
||||||
// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
|
||||||
// DocumentBuilder builder = factory.newDocumentBuilder();
|
|
||||||
//
|
|
||||||
// XPath xpath = XPathFactory.newInstance().newXPath();
|
|
||||||
//
|
|
||||||
// xpath.setNamespaceContext(new XalanNamespaceResolver(builder.parse(new InputSource(new StringReader(data))), true));
|
|
||||||
// XPathExpression exp = xpath.compile(transform);
|
|
||||||
// exp.evaluate(new InputSource(new StringReader(data)), XPathConstants.NODESET);
|
|
||||||
// return exp.evaluate(new InputSource(new StringReader(data)));
|
|
||||||
|
|
||||||
//data = "/home/adam/Programowanie/Java/XML Tools/release11-tools-web/SampleData/book.xml";
|
|
||||||
//transform = "/books/book[name = 'Hamlet']";
|
|
||||||
|
|
||||||
|
|
||||||
// Set up a DOM tree to query.
|
// Set up a DOM tree to query.
|
||||||
InputSource in = new InputSource(new StringReader(data));
|
InputSource in = new InputSource(new StringReader(data));
|
||||||
@@ -109,19 +94,13 @@ public class Xalan {
|
|||||||
// DOM may have more than one node corresponding to a
|
// DOM may have more than one node corresponding to a
|
||||||
// single XPath text node. Coalesce all contiguous text nodes
|
// single XPath text node. Coalesce all contiguous text nodes
|
||||||
// at this level
|
// at this level
|
||||||
sb = new StringBuilder(n.getNodeValue());
|
for (Node nn = n.getNextSibling(); isTextNode(nn); nn = nn.getNextSibling()) {
|
||||||
for (
|
|
||||||
Node nn = n.getNextSibling();
|
|
||||||
isTextNode(nn);
|
|
||||||
nn = nn.getNextSibling()
|
|
||||||
) {
|
|
||||||
result.append(nn.getNodeValue());
|
result.append(nn.getNodeValue());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
serializer.transform(new DOMSource(n), new StreamResult(new OutputStreamWriter(outputStream)));
|
serializer.transform(new DOMSource(n), new StreamResult(new OutputStreamWriter(outputStream)));
|
||||||
result.append(outputStream);
|
result.append(outputStream);
|
||||||
|
|
||||||
}
|
}
|
||||||
result.append("\n");
|
result.append("\n");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user