xmerl_scan

xmerl_scan

xmerl_scan
This module is the interface to the XML parser, it handles XML 1.0.

This module is the interface to the XML parser, it handles XML 1.0. The XML parser is activated through xmerl_scan:string/[1,2] or xmerl_scan:file/[1,2]. It returns records of the type defined in xmerl.hrl. See also tutorial on customization functions.

The document returned by xmerl_scan:string/[1,2] and xmerl_scan:file/[1,2]. The type of the returned record depends on the value of the document option passed to the function.

The global state of the scanner, represented by the #xmerl_scanner{} record.

Options allow to customize the behaviour of the scanner. See also tutorial on customization functions.

Possible options are:

Call back function to accumulate contents of entity.

Call back function to decide what to do if the scanner runs into EOF before the document is complete.

Call back function to handle scanner events.

Call back function to fetch an external resource.

Call back function to process the document entities once identified.

Called when document has been completely parsed.

Handles storing of scanner information when parsing.

Global state variable accessible from all customization functions

PathList is a list of directories to search when fetching files. If the file in question is not in the fetch_path, the URI will be used as a file name.

'preserve' (default) to preserve spaces, 'normalize' to accumulate consecutive whitespace and replace it with one space.

To specify starting line for scanning in document which contains fragments of XML.

Controls whether to behave as a namespace conformant XML parser, 'false' (default) to not otherwise 'true'.

Controls whether to process as a validating XML parser: 'off' (default) no validation, or validation 'dtd' by DTD or 'schema' by XML Schema. 'false' and 'true' options are obsolete (i.e. they may be removed in a future release), if used 'false' equals 'off' and 'true' equals 'dtd'.

Tells explicitly which XML Schema documents to use to validate the XML document. Used together with the {validation,schema} option.

Set to 'true' if xmerl should behave quietly and not output any information to standard output (default 'false').

Allows to specify DTD name when it isn't available in the XML document. This option has effect only together with {validation,'dtd' option.

XML Base directory. If using string/1 default is current directory. If using file/1 default is directory of given file.

Set default character set used (default UTF-8). This character set is used only if not explicitly given by the XML declaration.

Set to 'true' if xmerl should return a complete XML document as an xmlDocument record (default 'false').

Set to 'false' if xmerl should skip comments otherwise they will be returned as xmlComment records (default 'true').

Set to 'true' if xmerl should add to elements missing attributes with a defined default value (default 'false').

The record definition is found in xmerl.hrl.

Function to accumulate and normalize whitespace.

For controlling the ContinuationState, to be used in a continuation function, and called when the parser encounters the end of the byte stream. See tutorial on customization functions.

For controlling the EventState, to be used in an event function, and called at the beginning and at the end of a parsed entity. See tutorial on customization functions.

For controlling the FetchState, to be used in a fetch function, and called when the parser fetch an external resource (eg. a DTD). See tutorial on customization functions.

Types

Rest = list()

Parse file containing an XML document

For controlling the HookState, to be used in a hook function, and called when the parser has parsed a complete entity. See tutorial on customization functions.

For controlling the RulesState, to be used in a rules function, and called when the parser store scanner information in a rules database. See tutorial on customization functions.

Types

Rest = list()

Parse string containing an XML document