oxml
oxml
¶
Temporary stand-in for main oxml module.
This module came across with the PackageReader transplant. Probably much will get replaced with objects from the pptx.oxml.core and then this module will either get deleted or only hold the package related custom element classes.
BaseOxmlElement
¶
Bases: ElementBase
Base class for all custom element classes, to add standardized behavior to all classes in one place.
xml
property
¶
Return XML string for this element, suitable for testing purposes.
Pretty printed for readability and without an XML declaration at the top.
CT_Default
¶
Bases: BaseOxmlElement
<Default> element that appears in [Content_Types].xml part.
Used to specify a default content type to be applied to any part with the specified extension.
CT_Override
¶
Bases: BaseOxmlElement
<Override> element, specifying the content type to be applied for a part with
the specified partname.
CT_Relationship
¶
Bases: BaseOxmlElement
<Relationship> element, representing a single relationship from source to target part.
target_ref
property
¶
String held in the Target attribute of this <Relationship>
element.
target_mode
property
¶
String held in the TargetMode attribute of this <Relationship>
element, either Internal or External.
Defaults to Internal.
new
staticmethod
¶
Return a new <Relationship> element.
Source code in src/docx/opc/oxml.py
CT_Relationships
¶
Bases: BaseOxmlElement
<Relationships> element, the root element in a .rels file.
Relationship_lst
property
¶
Return a list containing all the <Relationship> child elements.
xml
property
¶
Return XML string for this element, suitable for saving in a .rels stream, not pretty printed and with an XML declaration at the top.
add_rel
¶
Add a child <Relationship> element with attributes set according to
parameter values.
Source code in src/docx/opc/oxml.py
new
staticmethod
¶
new() -> CT_Relationships
CT_Types
¶
Bases: BaseOxmlElement
<Types> element, the container element for Default and Override elements in
[Content_Types].xml.
parse_xml
¶
qn
¶
Stands for "qualified name", a utility function to turn a namespace prefixed tag name into a Clark-notation qualified tag name for lxml.
For
example, qn('p:cSld') returns '{http://schemas.../main}cSld'.
Source code in src/docx/opc/oxml.py
serialize_part_xml
¶
Serialize part_elm etree element to XML suitable for storage as an XML part.
That is to say, no insignificant whitespace added for readability, and an appropriate XML declaration added with UTF-8 encoding specified.
Source code in src/docx/opc/oxml.py
serialize_for_reading
¶
Serialize element to human-readable XML suitable for tests.
No XML declaration.