Parsing VO-DML files and validating against the rules obtained in this way.

Validation is something we expect to do only fairly rarely, so none of this code is expected to be efficient.

class, dmlTree)[source]

Bases: object

a vo-dml model.

These are usually constructed using the fromPrefix constructor, which uses a built-in mapping from well-known prefix to VO-DML file to populate the model.

classmethod fromFile(src, srcURL='http //not.given/invalid')[source]

returns a VO-DML model from src.

src can either be a file name (interpreted relative to the root of DaCHS’ VO-DML repository) or an open file (which will be closed as a side effect of this function).

This is intended for documents using non-standard models with custom prefixes (i.e., not known to DaCHS).

classmethod fromPrefix(prefix)[source]

returns a VO-DML model for a well-known prefix.

User code should typically use the getModelFromPrefix function.


returns a metadata dictionary for a VO-DML element with vodmlId.

This includes datatype add description. If vodmlId points to the value of a quantity, the associate unit and ucd attributes are returned as well.

If the vodmlId cannot be found, a NotFoundError is raised.


returns the element with vodmlId.

This raises a NotFoundError for elements that are not present.

This can be used with or without the prefix. The prefix is not validated, though.

getVOT(ctx, instance)[source]

returns xmlstan for a VOTable declaration of this DM.

property idIndex

returns a dictionary mapping vodmlids to elementtree objects., attName)[source]

returns the attribute definition for attName in typeDef as an etree.

This raises a NotFoundError if the attribute is not found.[source]

returns a vodml.Model instance for as well-known VODML prefix.

This caches models for prefixes and thus should usually be used from user code.

Note that this currently will currently return some stand-in shim for unknown prefixes. That behaviour will change to become a NotFoundError exception when there’s actually useful data models.[source]

returns an open file for the VO-DML file corresponding to prefix.

This will raise a NotFoundError for an unknown prefix.[source]

returns an etree element corresponding to the prefixed vodmlId.

Of course, this only works if vodmlId has a well-known prefix.