1xmerl(3)                   Erlang Module Definition                   xmerl(3)
2
3
4

NAME

6       xmerl - Functions for exporting XML data to an external format.
7

DESCRIPTION

9       Functions for exporting XML data to an external format.
10

EXPORTS

12       callbacks(Module) -> Result
13
14              Types:
15
16                 Module = atom()
17                 Result = [atom()]
18
19              Find the list of inherited callback modules for a given module.
20
21       export(Content, Callback) -> ExportedFormat
22
23              Equivalent to export(Data, Callback, []).
24
25       export(Content, Callback, RootAttributes) -> ExportedFormat
26
27              Types:
28
29                 Content = [Element]
30                 Callback = atom()
31                 RootAttributes = [XmlAttributes]
32
33              Exports  normal,  well-formed  XML  content, using the specified
34              callback-module.
35
36              Element is any of:
37
38                * #xmlText{}
39
40                * #xmlElement{}
41
42                * #xmlPI{}
43
44                * #xmlComment{}
45
46                * #xmlDecl{}
47
48              (See xmerl.hrl for the record definitions.) Text  in  #xmlText{}
49              elements can be deep lists of characters and/or binaries.
50
51              RootAttributes  is  a list of #xmlAttribute{} attributes for the
52              #root# element, which implicitly becomes the parent of the given
53              Content. The tag-handler function for #root# is thus called with
54              the complete exported data of Content. Root  attributes  can  be
55              used  to  specify  e.g.  encoding or other metadata of an XML or
56              HTML document.
57
58              The Callback module should contain hook functions for  all  tags
59              present  in  the  data  structure. A hook function must have the
60              following format:
61
62                  Tag(Data, Attributes, Parents, E)
63
64              where E is the corresponding #xmlElement{}, Data is the already-
65              exported  contents  of  E  and Attributes is the list of #xmlAt‐
66              tribute{} records of E. Finally, Parents is the list  of  parent
67              nodes of E, on the form [{ParentTag::atom(), ParentPosition::in‐
68              teger()}].
69
70              The hook function should return either the data to be  exported,
71              or  a  tuple {'#xml-alias#', NewTag::atom()}, or a tuple {'#xml-
72              redefine#', Content}, where Content is a content list (which can
73              be on simple-form; see export_simple/2 for details).
74
75              A  callback  module  can inherit definitions from other callback
76              modules, through the required function  '#xml-interitance#()  ->
77              [ModuleName::atom()].
78
79              See also: export/2, export_simple/3.
80
81       export_content(Es::Content, Callbacks) -> term()
82
83              Types:
84
85                 Content = [Element]
86                 Callback = [atom()]
87
88              Exports normal XML content directly, without further context.
89
90       export_element(E, CB) -> term()
91
92              Exports a normal XML element directly, without further context.
93
94       export_element(E, CallbackModule, CallbackState) -> ExportedFormat
95
96              For  on-the-fly  exporting during parsing (SAX style) of the XML
97              document.
98
99       export_simple(Content, Callback) -> ExportedFormat
100
101              Equivalent to export_simple(Content, Callback, []).
102
103       export_simple(Content, Callback, RootAttrs::RootAttributes) ->  Export‐
104       edFormat
105
106              Types:
107
108                 Content = [Element]
109                 Callback = atom()
110                 RootAttributes = [XmlAttributes]
111
112              Exports "simple-form" XML content, using the specified callback-
113              module.
114
115              Element is any of:
116
117                * {Tag, Attributes, Content}
118
119                * {Tag, Content}
120
121                * Tag
122
123                * IOString
124
125                * #xmlText{}
126
127                * #xmlElement{}
128
129                * #xmlPI{}
130
131                * #xmlComment{}
132
133                * #xmlDecl{}
134
135              where
136
137                * Tag = atom()
138
139                * Attributes = [{Name, Value}]
140
141                * Name = atom()
142
143                * Value = IOString | atom() | integer()
144
145              Normal-form XML elements can thus be included in the simple-form
146              representation.  Note  that  content  lists  must  be  flat.  An
147              IOString is a (possibly deep) list of  characters  and/or  bina‐
148              ries.
149
150              RootAttributes is a list of:
151
152                * XmlAttributes = #xmlAttribute{}
153
154              See export/3 for details on the callback module and the root at‐
155              tributes. The XML-data is always converted to normal form before
156              being passed to the callback module.
157
158              See also: export/3, export_simple/2.
159
160       export_simple_content(Content, Callback) -> term()
161
162              Exports simple XML content directly, without further context.
163
164       export_simple_element(Content, Callback) -> term()
165
166              Exports a simple XML element directly, without further context.
167

AUTHORS

169       <>
170
171
172
173                                 xmerl 1.3.33                         xmerl(3)
Impressum