1 #ifndef EL__DOM_CONFIGURATION_H
2 #define EL__DOM_CONFIGURATION_H
9 * The DOMConfiguration interface represents the configuration of a document.
10 * Using the configuration, it is possible to change the behaviour of how
11 * document normalization is done, such as replacing the CDATASection nodes
14 * Note: Parameters are similar to features and properties used in SAX2.
17 /** DOM configuration flags.
19 * The following list of parameters defined in the DOM: */
20 enum dom_config_flag
{
23 * The default is true and will keep CDATASection nodes in the
24 * document. When false, CDATASection nodes in the document are
25 * transformed into Text nodes. The new Text node is then combined with
26 * any adjacent Text node. */
27 DOM_CONFIG_CDATA_SECTIONS
= 1,
31 * If true (the default) keep Comment nodes in the document, else
33 DOM_CONFIG_COMMENTS
= 2,
35 /** "element-content-whitespace"
37 * The default is true and will keep all whitespaces in the document.
38 * When false, discard all Text nodes that contain only whitespaces. */
39 DOM_CONFIG_ELEMENT_CONTENT_WHITESPACE
= 4,
43 * When true (the default) keep EntityReference nodes in the document.
44 * When false, remove all EntityReference nodes from the document,
45 * putting the entity expansions directly in their place. Text nodes
46 * are normalized. Only unexpanded entity references are kept in the
47 * document. Note: This parameter does not affect Entity nodes. */
48 DOM_CONFIG_ENTITIES
= 8,
50 /** "normalize-characters"
52 * The default is false, not to perform character normalization, else
53 * fully normalized the characters in the document as defined in
54 * appendix B of [XML 1.1]. */
55 DOM_CONFIG_NORMALIZE_CHARACTERS
= 16,
59 * If false (default) nothing is done, else elements and attributes
60 * that are not known according to the built-in node info are
62 DOM_CONFIG_UNKNOWN
= 32,
64 /** "normalize-whitespace"
66 * If false (default) nothing is done, else all text nodes are
67 * normalized so that sequences of space characters are changed to
68 * being only a single space. */
69 DOM_CONFIG_NORMALIZE_WHITESPACE
= 64,
75 enum dom_config_flag flags
; /**< DOM configuration flags. */
77 /** A user defined error handler.
79 * Contains an error handler. If an error is encountered in the
80 * document, this handler is called. When called, DOMError.relatedData
81 * will contain the closest node to where the error occurred. If the
82 * implementation is unable to determine the node where the error
83 * occurs, DOMError.relatedData will contain the Document node.
85 void (*error_handler
)(struct dom_config
*, struct dom_error
*);
89 add_dom_config_normalizer(struct dom_stack
*stack
, struct dom_config
*config
,
90 enum dom_config_flag flags
);
93 parse_dom_config(unsigned char *flaglist
, unsigned char separator
);