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

xml.etree.ElementTree can't handle some elements. #58

Open
water5 opened this issue Oct 7, 2020 · 1 comment
Open

xml.etree.ElementTree can't handle some elements. #58

water5 opened this issue Oct 7, 2020 · 1 comment

Comments

@water5
Copy link

water5 commented Oct 7, 2020

I try to let it handle some actual xml feed document, it seems can't handle none pairs type XML dedicated elements,
e.g.

<?xml version="1.0" encoding="utf-8" ?>
will arise :

Traceback (most recent call last):
File "", line 1, in
File "/lib/ElementTree.py", line 130, in fromstring
File "/lib/ElementTree.py", line 108, in parse_el
IndexError: list index out of range

CDATA Sections https://www.w3.org/TR/REC-xml/#sec-cdata-sect
<channel><item><cdata_section><![CDATA[something to test.]]></cdata_section></item></channel>
will arise:

Traceback (most recent call last):
File "", line 1, in
File "/lib/ElementTree.py", line 130, in fromstring
File "/lib/ElementTree.py", line 94, in parse_el
File "/lib/xmltok2.py", line 131, in tokenize
File "/lib/xmltok2.py", line 96, in expect
XMLSyntaxError:

One of actual XML document:
https://www.w3.org/blog/news/feed

Is it possible improve it ?

@pfalcon
Copy link
Owner

pfalcon commented Oct 10, 2020

<?xml version="1.0" encoding="utf-8" ?>
will arise : IndexError: list index out of range

Yes, I noticed that too, that's addressed in the pycopy-xml.etree.ElementTree 0.2.1, just released.

CDATA Sections
will arise:

Yes, CDATA is not supported yet, as can be seen, it's not recognized on the level of tokenizer (xmltok2).

Is it possible improve it ?

Sure. The whole of pycopy-lib is developed in incremental way based on the needs of its users. Simple, clean patches adhering to the project guidelines/aims (https://github.com/pfalcon/pycopy-lib/blob/master/CONTRIBUTING.md , https://github.com/pfalcon/pycopy-lib/blob/master/README.md) are always welcome.

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

2 participants