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()
Attributes
- 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.