Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse Error when first line is blank #13

Open
Myriades-ll opened this issue Apr 14, 2021 · 0 comments
Open

Parse Error when first line is blank #13

Myriades-ll opened this issue Apr 14, 2021 · 0 comments

Comments

@Myriades-ll
Copy link

Hi.
parse error is thrown when first line is blank or is comment
the xml content:

<!-- first line is blank or have a comment, like this one -->
<?xml version="1.0" encoding="UTF-8"?>
<rss>
	<item>foo</item>
	<item>bar</item>
	<item>baz</item>
</rss>

the error:

  File "/usr/local/lib/python3.8/dist-packages/encoder.py", line 93, in parse
    EL = ET.fromstring(xml)
  File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1320, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: XML or text declaration not at start of entity: line 2, column 0

Removing the blank line or comment solves the problem.

Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant