Compare commits
5 Commits
778170e36d
...
xpath_vers
| Author | SHA1 | Date | |
|---|---|---|---|
| f7188380f6 | |||
| ee21a15600 | |||
| 3b4eeacb93 | |||
| a872350c9d | |||
| f618b882e8 |
@@ -79,11 +79,9 @@ def xpath(source: str, xpath: str) -> str:
|
|||||||
else:
|
else:
|
||||||
result_string = ""
|
result_string = ""
|
||||||
for e in result:
|
for e in result:
|
||||||
if isinstance(e, etree._Element):
|
result_string += etree.tostring(e, pretty_print=True).decode() + "\n"
|
||||||
result_string += etree.tostring(e, pretty_print=True).decode() + "\n"
|
return result_string, "node"
|
||||||
else:
|
|
||||||
result_string += str(e) + "\n"
|
|
||||||
return result_string, "node"
|
|
||||||
|
|
||||||
|
|
||||||
def xsd(source: str, xsd: str) -> bool:
|
def xsd(source: str, xsd: str) -> bool:
|
||||||
|
|||||||
@@ -61,13 +61,6 @@ public class Xalan implements XmlEngine{
|
|||||||
return nodeType == Node.CDATA_SECTION_NODE || nodeType == Node.TEXT_NODE;
|
return nodeType == Node.CDATA_SECTION_NODE || nodeType == Node.TEXT_NODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAttributeNode(Node n) {
|
|
||||||
if (n == null)
|
|
||||||
return false;
|
|
||||||
short nodeType = n.getNodeType();
|
|
||||||
return nodeType == Node.CDATA_SECTION_NODE || nodeType == Node.ATTRIBUTE_NODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String processXSLT(XMLMultipleFilesData[] data, String transform) throws Exception {
|
public String processXSLT(XMLMultipleFilesData[] data, String transform) throws Exception {
|
||||||
throw new UnsupportedOperationException("Xalan does not support multiple files XSLT processing");
|
throw new UnsupportedOperationException("Xalan does not support multiple files XSLT processing");
|
||||||
@@ -108,10 +101,7 @@ public class Xalan implements XmlEngine{
|
|||||||
for (Node nn = n.getNextSibling(); isTextNode(nn); nn = nn.getNextSibling()) {
|
for (Node nn = n.getNextSibling(); isTextNode(nn); nn = nn.getNextSibling()) {
|
||||||
resultString.append(nn.getNodeValue());
|
resultString.append(nn.getNodeValue());
|
||||||
}
|
}
|
||||||
} else if (isAttributeNode(n)) {
|
} else {
|
||||||
resultString.append(n.getNodeValue());
|
|
||||||
}
|
|
||||||
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)));
|
||||||
resultString.append(outputStream);
|
resultString.append(outputStream);
|
||||||
|
|||||||
Reference in New Issue
Block a user