Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Generated metadata doesn't follow xml schema #1

Open
npikki opened this issue Aug 9, 2022 · 3 comments
Open

Generated metadata doesn't follow xml schema #1

npikki opened this issue Aug 9, 2022 · 3 comments

Comments

@npikki
Copy link

npikki commented Aug 9, 2022

generate_new_metadata function in metadata_handling.py changes the order of elements in metadata ("Channel" and "TiffData" are removed and then appended, therefore if there were elements which came after them in the original metadata, they would come before them in the new metadata), example error of validating new metadata below:

`raise error
xmlschema.validators.exceptions.XMLSchemaChildrenValidationError: failed validating <Element '{http://www.openmicroscopy.org/Schemas/OME/2016-06}Pixels' at 0x7fc271f08130> with XsdGroup(model='sequence', occurs=[1, 1]):

Reason: Unexpected child with tag 'OME:Plane' at position 1. Tag ('OME:BinData' | 'OME:TiffData' | 'OME:MetadataOnly') expected.

Schema:

<xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema">
xsd:sequence
<xsd:element ref="Channel" minOccurs="0" maxOccurs="unbounded">
xsd:annotation
xsd:appinfo



</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:choice minOccurs="1" maxOccurs="1">
<xsd:element ref="BinData" minOccurs="1" maxOccurs="unbounded" />
<xsd:element ref="TiffData" minOccurs="1" maxOccurs="unbounded" />
<xsd:element ref="MetadataOnly" minOccurs="1" maxOccurs="1" />
</xsd:choice>
<xsd:element ref="Plane" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="ID" use="required" type="PixelsID" />
<xsd:attribute name="DimensionOrder" use="required">
...
...
</xsd:complexType>
`

@VasylVaskivskyi
Copy link
Member

Hi @npikki, in general order of nodes in the XML file doesn't matter. The validation error you got says that the node Plane is in the metadata, but it shouldn't be there.
Could you please provide more info on what you are validating: the actuall metadata you tried to validate, proper XML schema and software you used for validation.

@npikki
Copy link
Author

npikki commented Aug 19, 2022

Hi @VasylVaskivskyi , the order of nodes seems to matter in this schema since it (http://www.openmicroscopy.org/Schemas/OME/2016-06/#schema) specifies the elements as xsd:sequence rather than xsd:all .
I was using ome_types v.0.3.0 to load the metadata. Attached is the actual metadata.
ome_meta.txt

@VasylVaskivskyi
Copy link
Member

Hi @npikki, sorry it took me so long, I had (and still have) a lot of higher prioriry work. I just had a look at your metadata, do you need the Plane nodes? Do they contain any information that you use in your workflow? I personally never used them.
So, adding a proper way to handle them will require a lot of work for a very limited benefit. My solution would be to rather remove Plane nodes from the metadata, as they are not required by the schema.

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

No branches or pull requests

2 participants