File: xmerl.3

package info (click to toggle)
erlang-manpages 1%3A12.b.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,188 kB
  • ctags: 2
  • sloc: makefile: 68; perl: 30; sh: 15
file content (213 lines) | stat: -rw-r--r-- 4,592 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
.TH xmerl 3 "xmerl  1.1.9" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
xmerl \- Functions for exporting XML data to an external format\&.
.SH DESCRIPTION
.LP
Functions for exporting XML data to an external format\&. 

.SH EXPORTS
.LP
.B
callbacks(M::atom()) -> [atom()]
.br
.RS
.LP
Find the list of inherited callback modules for a given module\&.
.RE
.LP
.B
export(Data::Content, Callback) -> ExportedFormat
.br
.RS
.LP
Equivalent to export(Data, Callback, [])\&.
.RE
.LP
.B
export(Data::Content, Callback, RootAttrs::RootAttributes) -> ExportedFormat
.br
.RS
.TP
Types
Content = [Element]
.br
Callback = atom()
.br
RootAttributes = [XmlAttributes]
.br
.RE
.RS
.LP
Exports normal, well-formed XML content, using the specified callback-module\&. 
.LP
\fIElement\fR is any of:
.RS 2
.TP 2
*
\fI#xmlText{}\fR
.TP 2
*
\fI#xmlElement{}\fR
.TP 2
*
\fI#xmlPI{}\fR
.TP 2
*
\fI#xmlComment{}\fR
.TP 2
*
\fI#xmlDecl{}\fR
.RE
.LP
(See \fIxmerl\&.hrl\fR for the record definitions\&.) Text in \fI#xmlText{}\fR elements can be deep lists of characters and/or binaries\&.
.LP
\fIRootAttributes\fR is a list of \fI#xmlAttribute{}\fR attributes for the \fI#root#\fR element, which implicitly becomes the parent of the given \fIContent\fR\&. The tag-handler function for \fI#root#\fR is thus called with the complete exported data of \fIContent\fR\&. Root attributes can be used to specify e\&.g\&. encoding or other metadata of an XML or HTML document\&.
.LP
The \fICallback\fR module should contain hook functions for all tags present in the data structure\&. A hook function must have the following format:

.nf
    Tag(Data, Attributes, Parents, E)
.fi
.LP
where \fIE\fR is the corresponding \fI#xmlElement{}\fR, \fIData\fR is the already-exported contents of \fIE\fR and \fIAttributes\fR is the list of \fI#xmlAttribute{}\fR records of \fIE\fR\&. Finally, \fIParents\fR is the list of parent nodes of \fIE\fR, on the form \fI[{ParentTag::atom(), ParentPosition::integer()}]\fR\&.
.LP
The hook function should return either the data to be exported, or a tuple \fI{\&'#xml-alias#\&', NewTag::atom()}\fR, or a tuple \fI{\&'#xml-redefine#\&', Content}\fR, where \fIContent\fR is a content list (which can be on simple-form; see \fIexport_simple/2\fR for details)\&.
.LP
A callback module can inherit definitions from other callback modules, through the required function \fI\&'#xml-interitance#() -> [ModuleName::atom()]\fR\&.
.LP
\fISee also:\fR export/2, export_simple/3\&.
.RE
.LP
.B
export_content(Es::Content, CBs::Callbacks) -> term()
.br
.RS
.TP
Types
Content = [Element]
.br
Callback = [atom()]
.br
.RE
.RS
.LP
Exports normal XML content directly, without further context\&.
.RE
.LP
.B
export_element() -> term()
.br
.RS
.LP
Exports a normal XML element directly, without further context\&.
.RE
.LP
.B
export_element(E, CB::CBs, CBstate::UserState) -> ExportedFormat
.br
.RS
.LP
For on-the-fly exporting during parsing (SAX style) of the XML document\&.
.RE
.LP
.B
export_simple(Data::Content, Callback) -> ExportedFormat
.br
.RS
.LP
Equivalent to export_simple(Data, Callback, [])\&.
.RE
.LP
.B
export_simple(Data::Content, Callback, RootAttrs::RootAttributes) -> ExportedFormat
.br
.RS
.TP
Types
Content = [Element]
.br
Callback = atom()
.br
RootAttributes = [XmlAttributes]
.br
.RE
.RS
.LP
Exports "simple-form" XML content, using the specified callback-module\&. 
.LP
\fIElement\fR is any of:
.RS 2
.TP 2
*
\fI{Tag, Attributes, Content}\fR
.TP 2
*
\fI{Tag, Content}\fR
.TP 2
*
\fITag\fR
.TP 2
*
\fIIOString\fR
.TP 2
*
\fI#xmlText{}\fR
.TP 2
*
\fI#xmlElement{}\fR
.TP 2
*
\fI#xmlPI{}\fR
.TP 2
*
\fI#xmlComment{}\fR
.TP 2
*
\fI#xmlDecl{}\fR
.RE
.LP
where
.RS 2
.TP 2
*
\fITag = atom()\fR
.TP 2
*
\fIAttributes = [{Name, Value}]\fR
.TP 2
*
\fIName = atom()\fR
.TP 2
*
\fIValue = IOString | atom() | integer()\fR
.RE
.LP
Normal-form XML elements can thus be included in the simple-form representation\&. Note that content lists must be flat\&. An \fIIOString\fR is a (possibly deep) list of characters and/or binaries\&.
.LP
\fIRootAttributes\fR is a list of:
.RS 2
.TP 2
*
\fIXmlAttributes = #xmlAttribute{}\fR
.RE
.LP
See \fIexport/3\fR for details on the callback module and the root attributes\&. The XML-data is always converted to normal form before being passed to the callback module\&.
.LP
\fISee also:\fR export/3, export_simple/2\&.
.RE
.LP
.B
export_simple_content() -> term()
.br
.RS
.LP
Exports simple XML content directly, without further context\&.
.RE
.LP
.B
export_simple_element() -> term()
.br
.RS
.LP
Exports a simple XML element directly, without further context\&.
.RE