pugixml.pugi¶
Attributes
Encodings¶
These flags determine the encoding of input/output data for XML document.
See also
XMLDocument.load_buffer()
,
XMLDocument.load_file()
,
XMLDocument.save()
,
XMLDocument.save_file()
,
XMLNode.append_buffer()
,
XMLNode.print()
- pugi.ENCODING_AUTO = <XMLEncoding.ENCODING_AUTO: 0>¶
Auto-detect input encoding using BOM or
‘<’
/‘<?’
detection; use UTF8 if BOM is not found.
- pugi.ENCODING_LATIN1 = <XMLEncoding.ENCODING_LATIN1: 9>¶
ISO-8859-1 encoding (also known as Latin-1).
- pugi.ENCODING_UTF16 = <XMLEncoding.ENCODING_UTF16: 4>¶
UTF16 with native endianness.
- pugi.ENCODING_UTF16_BE = <XMLEncoding.ENCODING_UTF16_BE: 3>¶
Big-endian UTF16.
- pugi.ENCODING_UTF16_LE = <XMLEncoding.ENCODING_UTF16_LE: 2>¶
Little-endian UTF16.
- pugi.ENCODING_UTF32 = <XMLEncoding.ENCODING_UTF32: 7>¶
UTF32 with native endianness.
- pugi.ENCODING_UTF32_BE = <XMLEncoding.ENCODING_UTF32_BE: 6>¶
Big-endian UTF32.
- pugi.ENCODING_UTF32_LE = <XMLEncoding.ENCODING_UTF32_LE: 5>¶
Little-endian UTF32.
- pugi.ENCODING_UTF8 = <XMLEncoding.ENCODING_UTF8: 1>¶
UTF8 encoding.
- pugi.ENCODING_WCHAR = <XMLEncoding.ENCODING_WCHAR: 8>¶
The same encoding
wchar_t
has (either UTF16 or UTF32).
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
.
- 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.
Node Types¶
- pugi.NODE_CDATA = <XMLNodeType.NODE_CDATA: 4>¶
Character data, i.e.
‘<![CDATA[text]]>’
- pugi.NODE_COMMENT = <XMLNodeType.NODE_COMMENT: 5>¶
Comment tag, i.e.
‘<!– text –>’
- pugi.NODE_DECLARATION = <XMLNodeType.NODE_DECLARATION: 7>¶
Document declaration, i.e.
‘<?xml version=”1.0”?>’
- pugi.NODE_DOCTYPE = <XMLNodeType.NODE_DOCTYPE: 8>¶
Document type declaration, i.e.
‘<!DOCTYPE doc>’
- pugi.NODE_DOCUMENT = <XMLNodeType.NODE_DOCUMENT: 1>¶
A document tree’s absolute root.
- pugi.NODE_ELEMENT = <XMLNodeType.NODE_ELEMENT: 2>¶
Element tag, i.e.
‘<node/>’
- pugi.NODE_NULL = <XMLNodeType.NODE_NULL: 0>¶
Empty (null) node handle.
- pugi.NODE_PCDATA = <XMLNodeType.NODE_PCDATA: 3>¶
Plain character data, i.e.
‘text’
- pugi.NODE_PI = <XMLNodeType.NODE_PI: 6>¶
Processing instruction, i.e.
‘<?name?>’
Parsing Options¶
These flags control the contents of the resulting tree for all loading functions.
Note
This is a bitmask that customizes the parsing process:
to enable a flag, use mask | flag
; to disable a flag, use mask & ~flag
.
See also
XMLDocument.load_buffer()
,
XMLDocument.load_file()
,
XMLDocument.load_string()
,
XMLNode.append_buffer()
- pugi.PARSE_CDATA = 4¶
This flag determines if CDATA sections (
NODE_CDATA
) are added to the DOM tree. This flag is on by default.
- pugi.PARSE_COMMENTS = 2¶
This flag determines if comments (
NODE_COMMENT
) are added to the DOM tree. This flag is off by default.
- pugi.PARSE_DECLARATION = 256¶
This flag determines if document declaration (
NODE_DECLARATION
) is added to the DOM tree. This flag is off by default.
- pugi.PARSE_DEFAULT = 116¶
The default parsing mode. Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded, End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
- pugi.PARSE_DOCTYPE = 512¶
This flag determines if document type declaration (
NODE_DOCTYPE
) is added to the DOM tree. This flag is off by default.
- pugi.PARSE_EMBED_PCDATA = 8192¶
This flag determines if plain character data is be stored in the parent element’s value. This significantly changes the structure of the document; this flag is only recommended for parsing documents with many PCDATA nodes in memory-constrained environments. This flag is off by default.
- pugi.PARSE_EOL = 32¶
This flag determines if EOL characters are normalized (converted to #xA) during parsing. This flag is on by default.
- pugi.PARSE_ESCAPES = 16¶
This flag determines if character and entity references are expanded during parsing. This flag is on by default.
- pugi.PARSE_FRAGMENT = 4096¶
This flag determines if plain character data that does not have a parent node is added to the DOM tree, and if an empty document is a valid document. This flag is off by default.
- pugi.PARSE_FULL = 887¶
The full parsing mode. Nodes of all types are added to the DOM tree, character/reference entities are expanded, End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
- pugi.PARSE_MERGE_PCDATA = 16384¶
This flag determines whether determines whether the the two PCDATA should be merged or not, if no intermediatory data are parsed in the document. This flag is off by default.
- pugi.PARSE_MINIMAL = 0¶
Minimal parsing mode (equivalent to turning all other flags off). Only elements and PCDATA sections are added to the DOM tree, no text conversions are performed.
- pugi.PARSE_PI = 1¶
This flag determines if processing instructions (
NODE_PI
) are added to the DOM tree. This flag is off by default.
- pugi.PARSE_TRIM_PCDATA = 2048¶
This flag determines if leading and trailing whitespace is to be removed from plain character data. This flag is off by default.
- pugi.PARSE_WCONV_ATTRIBUTE = 64¶
This flag determines if attribute values are normalized using CDATA normalization rules during parsing. This flag is on by default.
- pugi.PARSE_WNORM_ATTRIBUTE = 128¶
This flag determines if attribute values are normalized using NMTOKENS normalization rules during parsing. This flag is off by default.
- pugi.PARSE_WS_PCDATA = 8¶
This flag determines if plain character data (
NODE_PCDATA
) that consist only of whitespace are added to the DOM tree. This flag is off by default; turning it on usually results in slower parsing and more memory consumption.
- pugi.PARSE_WS_PCDATA_SINGLE = 1024¶
This flag determines if plain character data (
NODE_PCDATA
) that is the only child of the parent node and that consists only of whitespace is added to the DOM tree. This flag is off by default; turning it on may result in slower parsing and more memory consumption.
Parsing Status¶
Parsing status, returned as part of XMLParseResult
object.
- pugi.STATUS_APPEND_INVALID_ROOT = <XMLParseStatus.STATUS_APPEND_INVALID_ROOT: 15>¶
Unable to append nodes since root type is not
NODE_ELEMENT
orNODE_DOCUMENT
(exclusive toXMLNode.append_buffer()
).
- pugi.STATUS_BAD_ATTRIBUTE = <XMLParseStatus.STATUS_BAD_ATTRIBUTE: 12>¶
Parsing error occurred while parsing element attribute.
- pugi.STATUS_BAD_CDATA = <XMLParseStatus.STATUS_BAD_CDATA: 8>¶
Parsing error occurred while parsing CDATA section.
- pugi.STATUS_BAD_COMMENT = <XMLParseStatus.STATUS_BAD_COMMENT: 7>¶
Parsing error occurred while parsing comment.
- pugi.STATUS_BAD_DOCTYPE = <XMLParseStatus.STATUS_BAD_DOCTYPE: 9>¶
Parsing error occurred while parsing document type declaration.
- pugi.STATUS_BAD_END_ELEMENT = <XMLParseStatus.STATUS_BAD_END_ELEMENT: 13>¶
Parsing error occurred while parsing end element tag.
- pugi.STATUS_BAD_PCDATA = <XMLParseStatus.STATUS_BAD_PCDATA: 10>¶
Parsing error occurred while parsing PCDATA section.
- pugi.STATUS_BAD_PI = <XMLParseStatus.STATUS_BAD_PI: 6>¶
Parsing error occurred while parsing document declaration/processing instruction.
- pugi.STATUS_BAD_START_ELEMENT = <XMLParseStatus.STATUS_BAD_START_ELEMENT: 11>¶
Parsing error occurred while parsing start element tag.
- pugi.STATUS_END_ELEMENT_MISMATCH = <XMLParseStatus.STATUS_END_ELEMENT_MISMATCH: 14>¶
There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or there was an excessive closing tag).
- pugi.STATUS_FILE_NOT_FOUND = <XMLParseStatus.STATUS_FILE_NOT_FOUND: 1>¶
File was not found during
XMLDocument.load_file()
.
- pugi.STATUS_INTERNAL_ERROR = <XMLParseStatus.STATUS_INTERNAL_ERROR: 4>¶
Internal error occurred.
- pugi.STATUS_IO_ERROR = <XMLParseStatus.STATUS_IO_ERROR: 2>¶
Error reading from file/stream.
- pugi.STATUS_NO_DOCUMENT_ELEMENT = <XMLParseStatus.STATUS_NO_DOCUMENT_ELEMENT: 16>¶
Parsing resulted in a document without element nodes.
- pugi.STATUS_OK = <XMLParseStatus.STATUS_OK: 0>¶
No error.
- pugi.STATUS_OUT_OF_MEMORY = <XMLParseStatus.STATUS_OUT_OF_MEMORY: 3>¶
Could not allocate memory.
- pugi.STATUS_UNRECOGNIZED_TAG = <XMLParseStatus.STATUS_UNRECOGNIZED_TAG: 5>¶
Parser could not determine tag type.
XPath Query Return Type¶
- pugi.XPATH_TYPE_BOOLEAN = <XPathValueType.XPATH_TYPE_BOOLEAN: 4>¶
Boolean.
- pugi.XPATH_TYPE_NODE_SET = <XPathValueType.XPATH_TYPE_NODE_SET: 1>¶
Node set (
XPathNodeSet
).
- pugi.XPATH_TYPE_NONE = <XPathValueType.XPATH_TYPE_NONE: 0>¶
Unknown type (query failed to compile).
- pugi.XPATH_TYPE_NUMBER = <XPathValueType.XPATH_TYPE_NUMBER: 2>¶
Number.
- pugi.XPATH_TYPE_STRING = <XPathValueType.XPATH_TYPE_STRING: 3>¶
String.
Misc.¶
- pugi.PUGIXML_VERSION = 1150¶
An integer literal representing the version of
pugixml
; major * 1000 + minor * 10 + patch.
pugixml.pugi.limits¶
Maximum and minimum finite values.
Attributes
- limits.DBL_MAX = 1.7976931348623157e+308¶
Maximum value of type
double
in C/C++.
- limits.DBL_MIN = 2.2250738585072014e-308¶
Minimum value of type
double
in C/C++.
- limits.FLT_MAX = 3.4028234663852886e+38¶
Maximum value of type
float
in C/C++.
- limits.FLT_MIN = 1.1754943508222875e-38¶
Minimum value of type
float
in C/C++.
- limits.INT_MAX = 2147483647¶
Maximum value of type
int
in C/C++.
- limits.INT_MIN = -2147483648¶
Minimum value of type
int
in C/C++.
- limits.LLONG_MAX = 9223372036854775807¶
Maximum value of type
long long
in C/C++.
- limits.LLONG_MIN = -9223372036854775808¶
Minimum value of type
long long
in C/C++.
- limits.UINT_MAX = 4294967295¶
Maximum value of type
unsigned int
in C/C++.
- limits.ULLONG_MAX = 18446744073709551615¶
Maximum value of type
unsigned long long
in C/C++.