1xmerl_eventp(3) Erlang Module Definition xmerl_eventp(3)
2
3
4
6 xmerl_eventp - Simple event-based front-ends to xmerl_scan for process‐
7 ing
8 of XML documents in streams and for parsing in SAX style.
9
11 Simple event-based front-ends to xmerl_scan for processing of XML docu‐
12 ments in streams and for parsing in SAX style. Each contain more elabo‐
13 rate settings of xmerl_scan that makes usage of the customization func‐
14 tions.
15
17 option_list():
18
19
20 Options allow to customize the behaviour of the scanner. See also
21 tutorial on customization functions.
22
23 Possible options are:
24
25 {acc_fun, Fun}:
26 Call back function to accumulate contents of entity.
27
28 {continuation_fun, Fun} | {continuation_fun, Fun, Continuation‐
29 State}:
30 Call back function to decide what to do if the scanner runs into
31 EOF before the document is complete.
32
33 {event_fun, Fun} | {event_fun, Fun, EventState}:
34 Call back function to handle scanner events.
35
36 {fetch_fun, Fun} | {fetch_fun, Fun, FetchState}:
37 Call back function to fetch an external resource.
38
39 {hook_fun, Fun} | {hook_fun, Fun, HookState}:
40 Call back function to process the document entities once identi‐
41 fied.
42
43 {close_fun, Fun}:
44 Called when document has been completely parsed.
45
46 {rules, ReadFun, WriteFun, RulesState} | {rules, Rules}:
47 Handles storing of scanner information when parsing.
48
49 {user_state, UserState}:
50 Global state variable accessible from all customization functions
51
52 {fetch_path, PathList}:
53 PathList is a list of directories to search when fetching files.
54 If the file in question is not in the fetch_path, the URI will be
55 used as a file name.
56
57 {space, Flag}:
58 'preserve' (default) to preserve spaces, 'normalize' to accumu‐
59 late consecutive whitespace and replace it with one space.
60
61 {line, Line}:
62 To specify starting line for scanning in document which contains
63 fragments of XML.
64
65 {namespace_conformant, Flag}:
66 Controls whether to behave as a namespace conformant XML parser,
67 'false' (default) to not otherwise 'true'.
68
69 {validation, Flag}:
70 Controls whether to process as a validating XML parser: 'off'
71 (default) no validation, or validation 'dtd' by DTD or 'schema'
72 by XML Schema. 'false' and 'true' options are obsolete (i.e. they
73 may be removed in a future release), if used 'false' equals 'off'
74 and 'true' equals 'dtd'.
75
76 {schemaLocation, [{Namespace,Link}|...]}:
77 Tells explicitly which XML Schema documents to use to validate
78 the XML document. Used together with the {validation,schema}
79 option.
80
81 {quiet, Flag}:
82 Set to 'true' if xmerl should behave quietly and not output any
83 information to standard output (default 'false').
84
85 {doctype_DTD, DTD}:
86 Allows to specify DTD name when it isn't available in the XML
87 document. This option has effect only together with {valida‐
88 tion,'dtd' option.
89
90 {xmlbase, Dir}:
91 XML Base directory. If using string/1 default is current direc‐
92 tory. If using file/1 default is directory of given file.
93
94 {encoding, Enc}:
95 Set default character set used (default UTF-8). This character
96 set is used only if not explicitly given by the XML declaration.
97
98 {document, Flag}:
99 Set to 'true' if xmerl should return a complete XML document as
100 an xmlDocument record (default 'false').
101
102 {comments, Flag}:
103 Set to 'false' if xmerl should skip comments otherwise they will
104 be returned as xmlComment records (default 'true').
105
106 {default_attrs, Flag}:
107 Set to 'true' if xmerl should add to elements missing attributes
108 with a defined default value (default 'false').
109
110 xmlElement() = #xmlElement{}:
111
112
114 file_sax(Fname::string(), CallBackModule::atom(), UserState,
115 Options::option_list()) -> NewUserState
116
117 Parse file containing an XML document, SAX style. Wrapper for a
118 call to the XML parser xmerl_scan with a hook_fun for using
119 xmerl export functionality directly after an entity is parsed.
120
121 stream(Fname::string(), Options::option_list()) -> xmlElement()
122
123 Parse file containing an XML document as a stream, DOM style.
124 Wrapper for a call to the XML parser xmerl_scan with a continua‐
125 tion_fun for handling streams of XML data. Note that the contin‐
126 uation_fun, acc_fun, fetch_fun, rules and close_fun options can‐
127 not be user defined using this parser.
128
129 stream_sax(Fname, CallBack::CallBackModule, UserState, Options) ->
130 xmlElement()
131
132 Types:
133
134 Fname = string()
135 CallBackModule = atom()
136 Options = option_list()
137
138 Parse file containing an XML document as a stream, SAX style.
139 Wrapper for a call to the XML parser xmerl_scan with a continua‐
140 tion_fun for handling streams of XML data. Note that the contin‐
141 uation_fun, acc_fun, fetch_fun, rules, hook_fun, close_fun and
142 user_state options cannot be user defined using this parser.
143
144 string_sax(String::list(), CallBackModule::atom(), UserState,
145 Options::option_list()) -> xmlElement()
146
147 Parse file containing an XML document, SAX style. Wrapper for a
148 call to the XML parser xmerl_scan with a hook_fun for using
149 xmerl export functionality directly after an entity is parsed.
150
152 <>
153
154
155
156 xmerl 1.3.26 xmerl_eventp(3)