erinxocon / requests-xml

Requests-XML: XML Parsing for Humans
http://xml.python-requests.org
MIT License
186 stars 6 forks source link

XMLSyntaxError: StartTag: Invalid element name #2

Closed whatamithinking closed 6 years ago

whatamithinking commented 6 years ago

OS: Windows Python Version: 3.6.5 -- downloaded today directly from the site

from requests_xml import XMLSession s=XMLSession() p=s.get( 'https://www.google.com/' ) p.xml.xpath( '//div' ) Traceback (most recent call last): File "", line 1, in File "C:\Users\conno\AppData\Local\Programs\Python\Python36\lib\site-packages\requests_xml.py", line 224, in xpath selected = self.lxml.xpath(selector) File "C:\Users\conno\AppData\Local\Programs\Python\Python36\lib\site-packages\requests_xml.py", line 120, in lxml self._lxml = etree.fromstring(self.raw_xml) File "src\lxml\etree.pyx", line 3230, in lxml.etree.fromstring (src\lxml\etree.c:81056) File "src\lxml\parser.pxi", line 1871, in lxml.etree._parseMemoryDocument (src\lxml\etree.c:121236) File "src\lxml\parser.pxi", line 1759, in lxml.etree._parseDoc (src\lxml\etree.c:119912) File "src\lxml\parser.pxi", line 1125, in lxml.etree._BaseParser._parseDoc (src\lxml\etree.c:114159) File "src\lxml\parser.pxi", line 598, in lxml.etree._ParserContext._handleParseResultDoc (src\lxml\etree.c:107724) File "src\lxml\parser.pxi", line 709, in lxml.etree._handleParseResult (src\lxml\etree.c:109433) File "src\lxml\parser.pxi", line 638, in lxml.etree._raiseParseError (src\lxml\etree.c:108287) File "", line 1 lxml.etree.XMLSyntaxError: StartTag: invalid element name, line 1, column 2

erinxocon commented 6 years ago

If you are pulling in html you should use @kennethreitz's requests-html! Is there a reason you are using my lib instead of his? If so let me know!

whatamithinking commented 6 years ago

Ahh...I misunderstood what your library does. I thought your library would intake pages returned by requests and then allow for xpath searches on them.

requests-html is what I need.

Thank you.

erinxocon commented 6 years ago

@ConnorSMaynes They do similar things, mine is just a little more fine tuned for pure xml. :)