ElementWithXSIType¶
- class pyvo.utils.xml.elements.ElementWithXSIType(*args, **kwargs)[source]¶
Bases:
Element
An XML element that supports type dispatch through xsi:type.
When a class A is derived from this, it gains a decorator register_xsi_type, which classes derived from A can use to say “construct me rather than A when xsi:type has the value I’m putting in.
At this point we are doing no namespace processing in our XML parsing. Hence, we discard any prefixes both when registering and when matching.
We probably should do namespaces one day; astropy.utils.xml will presumably learn them when they add VO-DML support. Let’s revisit this when it’s there safely. Meanwhere, use canonical Registry prefixes (cf. RegTAP 1.1, sect. 5) everywhere in your code; these will continue to be safe no matter what.
Methods Summary
register_xsi_type
(typename)Decorator factory for registering subtypes.
Methods Documentation