5,475 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
4
votes
1
answer
144
views
lxml: QName value does not resolve to a(n) attribute group definition
I get the following error, while trying to validate XML using a schema:
lxml.etree.XMLSchemaParseError: Element '{http://www.w3.org/2001/XMLSchema}attributeGroup', attribute 'ref': The QName value '{...
0
votes
0
answers
38
views
New validation of xml by .iterparse
Good Morning,
Does anyone use validation via .iterparse?
I need to rebuild the plugin to validate files over 2GB.
To do this, I need to change the parser – I'm using etree.iterparse instead of lxml....
0
votes
0
answers
109
views
Unexpected(?) availability of child elements during start events in lxml.etree.iterparse
I’m writing a sitemap XML parser using lxml.etree.iterparse
class Sitemap:
"""Class to parse Sitemap (type=urlset) and Sitemap Index
(type=sitemapindex) files"""
...
-1
votes
2
answers
217
views
What is the difference between xpath() and findall()?
Very often I see that calls to xpath could as well be replaced by calls to findall, when can this be done? What is the main differences between the two functions?
The first argument to path findall ...
Moberg's user avatar
- 5,655
-1
votes
1
answer
419
views
Building wheel for lxml (pyproject.toml)
Building wheels for collected packages: lxml
Building wheel for lxml (pyproject.toml) ... error
error: subprocess-exited-with-error
×ばつ Building wheel for lxml (pyproject.toml) did not run ...
2
votes
1
answer
34
views
Parsing question for Python with LXML and Requests (Soap)
This is an example response:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header />
<soap-env:Body>
<api:...
2
votes
2
answers
98
views
Python lxml xpath not working on some elements
I'm having trouble extracting a specific element text from a soap response. Other elements seems to be working fine.
I have tried the following:
Python 3.13.3 (main, Apr 8 2025, 13:54:08) [Clang 16.0....
ads's user avatar
- 1,743
0
votes
1
answer
72
views
Preserve line breaks in XML attributes when parsing with lxml
I'm trying to batch-process a couple of XML files through a python script, with the XML files having line breaks in some of their attributes like so:
<?xml version='1.0' encoding='UTF-8'?>
<...
2
votes
1
answer
62
views
How to Cache Elements to increase the Runtime Performance with lxml Pythin Library
In the lxml.de website https://lxml.de/performance.html
I see the following statement:
A way to improve the normal attribute access time is static instantiation of the Python objects, thus trading ...
0
votes
1
answer
49
views
How can we resolve a comment in a docx file using lxml
I have been working with Python docx and lxml to build a backend that can add comment, to specific texts and then resolve those comments. I have successfully managed to add comments but i am having ...
0
votes
1
answer
61
views
python lxml and getting a table from word document
I'm working on pulling some information from word document. I have multiple tables in it and i want to get 1 specific table that does not have any specific location in the document that could be ...
2
votes
1
answer
87
views
lxml target interface splits data on non-ascii characters -- how can I get the whole string?
Here's a file test.xml:
<?xml version="1.0" encoding="UTF-8"?>
<list>
<entry>data</entry>
<entry>Łódź</entry>
<entry>data Łódź</...
1
vote
1
answer
89
views
Iterate xml using namespace prefix
I have an xml file with a default namespace, like this:
<?xml version="1.0" encoding="utf-8"?>
<root xmlns="somelongnamespace">
<child>...</child&...
0
votes
1
answer
59
views
Python lxml.html SyntaxError: invalid predicate with XPATH when using lxml find
I am using CPython 3.12.6, lxml 5.3.1, Windows 11 Pro 23H2 x64.
The following Python code raises an exception:
tree.find(".//table[contains(@class, 'wikitable')]//tr")
SyntaxError: invalid ...
1
vote
2
answers
63
views
Identify broken XML files inside a zipped archive
I am trying to read a large number of zipped files (.zip or .docx) in a loop, each again containing a large number of embedded XML (.xml) files inside them. However some of the embedded XML files are ...