Removed unused code

This commit is contained in:
2023-02-09 13:24:28 +01:00
parent 45a7e60ae4
commit 4b241978e0

View File

@@ -65,27 +65,12 @@ public class Xalan {
/**
* 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 transform xpath
* @return xml processed using given xpath
* @throws Exception thrown on node building errors or invalid xpath
*/
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.
InputSource in = new InputSource(new StringReader(data));
@@ -109,19 +94,13 @@ public class Xalan {
// DOM may have more than one node corresponding to a
// single XPath text node. Coalesce all contiguous text nodes
// 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());
}
} else {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
serializer.transform(new DOMSource(n), new StreamResult(new OutputStreamWriter(outputStream)));
result.append(outputStream);
}
result.append("\n");
}