Output Options
These flags control the contents of the resulting tree for all saving functions.
Note
This is a bitmask that customizes the output format:
to enable a flag, use mask | flag; to disable a flag, use mask & ~flag.
Attributes
- pugi.FORMAT_ATTRIBUTE_SINGLE_QUOTE = 512
Use U+0027 (’) instead of U+0022 (”) for enclosing attribute values. This flag is off by default.
- pugi.FORMAT_DEFAULT = 1
The default set of formatting flags. Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
- pugi.FORMAT_INDENT = 1
Indent the nodes that are written to output stream with as many indentation strings as deep the node is in DOM tree. This flag is on by default.
- pugi.FORMAT_INDENT_ATTRIBUTES = 64
Write every attribute on a new line with appropriate indentation. This flag is off by default.
- pugi.FORMAT_NO_DECLARATION = 8
Omit default XML declaration even if there is no declaration in the document. This flag is off by default.
- pugi.FORMAT_NO_EMPTY_ELEMENT_TAGS = 128
Don’t output empty element tags, instead writing an explicit start and end tag even if there are no children. This flag is off by default.
- pugi.FORMAT_NO_ESCAPES = 16
Don’t escape attribute values and PCDATA contents. This flag is off by default.
- pugi.FORMAT_RAW = 4
Use raw output mode (no indentation and no line breaks are written). This flag is off by default.
- pugi.FORMAT_SAVE_FILE_TEXT = 32
Open file using text mode in
XMLDocument.save_file(). This enables special character (i.e. new-line) conversions on some systems. This flag is off by default.
- pugi.FORMAT_SKIP_CONTROL_CHARS = 256
Skip characters belonging to range [0, 32) instead of “&#xNN;” encoding. This flag is off by default.
- pugi.FORMAT_WRITE_BOM = 2
Write encoding-specific BOM to the output stream. This flag is off by default.