Questions tagged [lxml]

lxml is a full-featured, high performance Python library for processing XML and HTML.

Questions that concern the lxml Python library should have this tag. Per the XML website, "The lxml XML toolkit is a Pythonic binding for the C libraries libxml2 and libxslt." The library's lxml.etree package is used for XML processing. lxml's BeautifulSoup package parses broken HTML. html5lib uses the HTML5 parsing algorithm.

Links:

https://lxml.de/ - Contains API documentation and tutorials

https://www.ibm.com/developerworks/xml/library/x-hiperfparse/ - IBM developerWorks page on lxml

5412 questions
2
votes
1 answer

How do I select a link with a right arrow as the text with xpath?

I'm attempting to select the next button on a website, and it has a right arrow as the text of the link. When I view the source using "scrappy shell" it shows me the character as its unicode literal "\u2192". With this, I developed the following…
Brad T
  • 23
  • 3
2
votes
1 answer

How to correct this python3.4 lxml multicore detection?

Trying to build lxml with static dependencies > # python3.4 setup.py bdist_egg --static-deps ... config.status: creating Makefile config.status: executing libtool commands make: Warning: Ignoring DistributedMake -j option make: Fatal error: No…
DrLou
  • 649
  • 5
  • 21
2
votes
1 answer

Getting parent tag id with lxml

I am trying scrape a dummy site and get the parent tag of one that I am searching for. Heres the structure of the code I am searching for:
Heres my python…
user2157179
  • 238
  • 2
  • 4
  • 19
2
votes
1 answer

XPath for sub-element's text value in lxml

First of all, is it possible to do such thing? I have been trying out to generate Xpath expression by using "sub-element text values" present in webpage. Trying to do this using lxml (etree, html, getpath), ElementTree modules in Python. But I don't…
techDiscussion
  • 89
  • 3
  • 12
2
votes
1 answer

lxml for Qpython3 (Python3 on Android)

Is there a way to install lxml on Qpython3(Python3 on Android)? I could not find anything on google. Any help would be greatly appreciated.
2
votes
2 answers

xml to Python data structure using lxml

How can I convert xml to Python data structure using lxml? I have searched high and low but can't find anything. Input example Mozilla Firefox firefox Leading Open Source…
Samuel Taylor
  • 1,181
  • 2
  • 14
  • 25
2
votes
1 answer

Not Condition In xpath

I have the following xml : This is a question on xpath Do not extract this I…
Hypothetical Ninja
  • 3,920
  • 13
  • 49
  • 75
2
votes
0 answers

Scraping Data with Python and LXML

I am facing some difficulty in scraping data with lxml. The code snippet is: from lxml import etree parser = etree.HTMLParser() f = open("test1.html", "r") content = f.read() tree = etree.fromstring(content, parser) print…
user3001408
  • 310
  • 5
  • 20
2
votes
2 answers

How would you give Chrome's version of a webpage to python?

I'm trying to make it easy for users to input numbers from a web page. The easiest thing I can imagine would be for them to provide a url and an xpath associated with that number. My code could then go grab the numbers. The concept of an xpath…
Doug Bradshaw
  • 1,452
  • 1
  • 16
  • 20
2
votes
1 answer

lxml (xml python parser) go to next element

Has someone know how to jump to the next element in xml? i.e Text number 2 Text number 3 ... Text number N ... I would like to be able…
user3900778
  • 227
  • 3
  • 14
2
votes
2 answers

Extracting contents from a list split across different divs

Consider the following html

Section-Header-1

  • item1a
  • item1b
  • item1c
  • item1d
pad
  • 2,296
  • 2
  • 16
  • 23
2
votes
1 answer

python: examine XSD xml schema

I would like to examine a XSD schema in python. Currently I'm using lxml which is doing it's job very very well when it only has to validate a document against the schema. But, I want to know what's inside of the schema and access the elements in…
2
votes
1 answer

XSLT get parent in match lxml python

i have this XML:
W4ldi
  • 644
  • 5
  • 11
2
votes
0 answers

Error when installing python-xbrl 1.0.7

I got the problem of installing xbrl module to python, and it has bothered me for two days and I haven't solved it. I successfully installed pip. I got the same problem when installing lxml https://pypi.python.org/pypi/python-xbrl/1.0.7 When I use:…
Zee
  • 51
  • 1
  • 4
2
votes
1 answer

How to add python keyword terms as tag attributes in lxml?

I'm using lxml to build an XML based on some data. root = etree.Element('sentences') for item in aspectSentenceList: print item sentenceTag = etree.SubElement(root, "sentence", id=item[0]) textTag = etree.SubElement(sentenceTag,…
Aditya
  • 3,080
  • 24
  • 47