Parsing VO-DML files and (perhaps one day) 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.

getAttributeMeta(typeName, attrName)[source]

returns a metadata dictionary for a the attribute attrName of the type referenced by type name.

attrName is the unqualified attribute name. typeName may be qualified, but prefixes are ignored.

Do not pass in unparsed strings to typeName and attrName; they are blindly used in xpath expressions.

The metadata returned includes datatype, description, and vodmlId.

If either the data model, or type, or the attribute 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 a prefix. The prefix is just discarded, though.

Do not pass in unparsed ids; they are used in xpaths.


returns an etree for a data or object type with the name name within this DM.

Any prefix on name will be discarded without further ado. Don’t pass in anythin unparsed here; we are using xpaths.

getVOT(ctx, instance)[source]

returns xmlstan for a VOTable declaration of this DM., attrName)[source]

returns attribute metadata for a type.

qualifiedType is a type name with a prefix, attrName is the attribute’s name (not vodml-id).[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.