Not properly objectifying attributes

Bug #1850221 reported by brent saner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
New
Undecided
Unassigned

Bug Description

= VERSION INFO =

Python : sys.version_info(major=3, minor=7, micro=4, releaselevel='final', serial=0)
lxml.etree : (4, 4, 1, 0)
libxml used : (2, 9, 9)
libxml compiled : (2, 9, 9)
libxslt used : (1, 1, 33)
libxslt compiled : (1, 1, 33)

= ISSUE =

It seems that when objectifying, attributes don't seem to be properly following the XSI schema.

= REPRODUCTION =
I have attached a tarball of a POC (there are some irrelevant function calls before it; they can be ignored). It demonstrates that text() objects are indeed properly identified and objectified as e.g. xs:positiveInteger => int() as according to their xsi type, but attributes with e.g. base type xs:positiveInteger are interpolated as type str().

./test.py in the tarball should get you a dump and it's commented with where it does what I... don't expect it to.

Is this expected?

Revision history for this message
brent saner (brent-saner) wrote :
Revision history for this message
brent saner (brent-saner) wrote :

Sorry; worth noting that the XSD and XML validate per xmllint(1):

[bts@cylon testxml]$ xmllint --noout --schema test.xsd test.xml
test.xml validates

and via lxml's validation as well (done from the same directory as the POC tarball):

[bts@cylon testxml]$ python
Python 3.7.4 (default, Oct 4 2019, 06:57:26)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import base
>>> import XSD
>>> xsd = XSD.XSD()
>>> xml = base.XML()
>>> xsd.isValid(xml)
True

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.