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

to_xml() produces invalid datetimes. #104

Closed
MatteBailey opened this issue Aug 24, 2021 · 2 comments · Fixed by #106
Closed

to_xml() produces invalid datetimes. #104

MatteBailey opened this issue Aug 24, 2021 · 2 comments · Fixed by #106

Comments

@MatteBailey
Copy link

We recently discovered that the to_xml() function provided by ome-types produces datetimes that look like 2016-03-11T10:23:44.925154UTC, which violate the XSD dateTime format. Instead, the datetime in this case should be 2016-03-11T10:23:44.9251548Z, which is what is in the source XML.

Steps to reproduce:

  1. Extract OverViewScan.ome.xml from this ZIP: OverViewScan.ome.xml.zip
  2. Load that XML into ome-types, output it to XML, and try to load it again, like this:
from pathlib import Path
from ome_types import from_xml, to_xml

if __name__ == '__main__':
    og_xml = Path("OverViewScan.ome.xml").read_text()
    ome = from_xml(og_xml)
    output_xml = to_xml(ome)
    from_xml(output_xml)
  1. Receive the following error:
xmlschema.validators.exceptions.XMLSchemaDecodeError: failed validating '2016-03-11T10:23:44.925154UTC' with XsdAtomicBuiltin(name='xs:dateTime'):

Reason: attribute StartTime='2016-03-11T10:23:44.925154UTC': Invalid datetime string '2016-03-11T10:23:44.925154UTC' for <class 'elementpath.datatypes.datetime.DateTime10'>

Thanks for taking a look!

@tlambert03
Copy link
Owner

Thanks @MatteBailey.
can you tell me what version of elementpath and xmlschema you have installed?

@MatteBailey
Copy link
Author

From running pip list, I get elementpath 2.2.3 and xmlschema 1.4.1.

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

Successfully merging a pull request may close this issue.

2 participants