The oslo_reports.views.xml.generic
Module¶
Provides generic XML views
This modules defines several basic views for serializing
data to XML. Submodels that have already been serialized
as XML may have their string values marked with __is_xml__
= True using oslo_reports._utils.StringWithAttrs
(each of the classes within this module does this automatically,
and non-naive serializers check for this attribute and handle
such strings specially)
-
class
oslo_reports.views.xml.generic.
KeyValueView
(wrapper_name='model')¶ Bases:
object
A Key-Value XML View
This view performs advanced serialization of a data model into XML. It first deserializes any values marked as XML so that they can be properly reserialized later. It then follows the following rules to perform serialization:
- key : text/xml
- The tag name is the key name, and the contents are the text or xml
- key : Sequence
- A wrapper tag is created with the key name, and each item is placed in an ‘item’ tag
- key : Mapping
- A wrapper tag is created with the key name, and the serialize is called on each key-value pair (such that each key gets its own tag)
Parameters: wrapper_name (str) – the name of the top-level element