fix libxml xpath bugs
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from typing import Any
|
||||
|
||||
from lxml import etree, html
|
||||
from io import BytesIO
|
||||
|
||||
@@ -79,9 +81,11 @@ def xpath(source: str, xpath: str) -> str:
|
||||
else:
|
||||
result_string = ""
|
||||
for e in result:
|
||||
result_string += etree.tostring(e, pretty_print=True).decode() + "\n"
|
||||
return result_string, "node"
|
||||
|
||||
if isinstance(e, etree._Element):
|
||||
result_string += etree.tostring(e, pretty_print=True).decode() + "\n"
|
||||
else:
|
||||
result_string += str(e) + "\n"
|
||||
return result_string, "node"
|
||||
|
||||
|
||||
def xsd(source: str, xsd: str) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user