You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.
When preparing my XSD for PyXB binding, i would love to have access to the annotations of the type / attribute /element i am at in the XSD so i can inspect the bindings later on (while parsing the XML instance document) to see the annotations.
I would like i.e. to define an XSD annotation which states an attribute as a reference to another element so i can iterate over the instance document to resolve the reference later.
import myxsd
doc=myxsd.CreateFromLocation(...)
for var in doc.var:
if var._type.annotation.appinfo ... :
# look for source type
# add attribute to var:
var.type_resolved=findInDoc(doc,appinfo.xsdTypeRef())
(Roughly draftet so you hopefully get the idea).
The purpose of this is to annotate the schema so i can create a post-processing step over the instance XML document which looks at the annotations from the XSD to perform project-specific tasks like resolving references in the XML document or add specific consistency checks.
The reason to put it into the XSD is to have a single place where the datamodel is defined (XSD) and have a generic postprocessing based on PyXB and annotations which works for all data models.
The text was updated successfully, but these errors were encountered:
Currently i am able to work around this by misusing the doucmentation field:
from build import msgdb
doc=msgdb.CreateFromDocument(open("MessageDB-Example.xml").read())
print("Gives type doc:")
print(doc.__doc__)
print("gives type name:")
print(doc._element().typeDefinition()._ExpandedName.localName())
So i need to parse the type doc to look out for my "annotation" and handle that.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When preparing my XSD for PyXB binding, i would love to have access to the annotations of the type / attribute /element i am at in the XSD so i can inspect the bindings later on (while parsing the XML instance document) to see the annotations.
I would like i.e. to define an XSD annotation which states an attribute as a reference to another element so i can iterate over the instance document to resolve the reference later.
So in XSD i would like to write:
And in my code i would like to write:
(Roughly draftet so you hopefully get the idea).
The purpose of this is to annotate the schema so i can create a post-processing step over the instance XML document which looks at the annotations from the XSD to perform project-specific tasks like resolving references in the XML document or add specific consistency checks.
The reason to put it into the XSD is to have a single place where the datamodel is defined (XSD) and have a generic postprocessing based on PyXB and annotations which works for all data models.
The text was updated successfully, but these errors were encountered: