|
|
@ -114,11 +114,12 @@ def elementpath_tostring(obj):
|
|
|
|
|
|
|
|
|
|
|
|
def forest_transplanting(root):
|
|
|
|
def forest_transplanting(root):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
The html parser of libxml2 violates DOM rules. It means there can be multiple root element
|
|
|
|
The html parser of libxml2 violates DOM rules. It means there can be
|
|
|
|
nodes. So I choose just transplating them to a new root by default.
|
|
|
|
multiple root element nodes. So I choose just transplating them to a new
|
|
|
|
See also, https://gitlab.gnome.org/GNOME/libxml2/-/issues/716
|
|
|
|
root when the violation happens. See also,
|
|
|
|
This will emulate xpath1 of html of libxml2 like '/html[2]/*'.
|
|
|
|
https://gitlab.gnome.org/GNOME/libxml2/-/issues/716 This will emulate
|
|
|
|
To make this function work, 'fragment=True' in elementpath.select is required.
|
|
|
|
xpath1 of html of libxml2 like '/html[2]/*'. To make this function work,
|
|
|
|
|
|
|
|
'fragment=True' in elementpath.select is required.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
from lxml import etree
|
|
|
|
from lxml import etree
|
|
|
|
|
|
|
|
|
|
|
|