Exported Functions | |
---|---|
callbacks/1 | Find the list of inherited callback modules for a given module. |
export/2 | See export/3. |
export/3 | Exports normal, well-formed XML content, using the specified callback-module. |
export_content/2 | Exports normal XML content directly, without further context. |
export_element/2 | Exports a normal XML element directly, without further context. |
export_element/3 | For on-the-fly exporting during parsing (SAX style) of the XML document. |
export_simple/2 | See export_simple/3. |
export_simple/3 | Exports "simple-form" XML content, using the specified callback-module. |
callbacks(atom()) -> [atom()]
Find the list of inherited callback modules for a given module.
export(Content, Callback) -> ExportedFormat
Equivalent to export(Data, Callback, []) .
export(Content, Callback, RootAttributes) -> ExportedFormat
Exports normal, well-formed XML content, using the specified
callback-module.
Element
is any of:
#xmlText{}
#xmlElement{}
#xmlPI{}
#xmlComment{}
#xmlDecl{}
#xmlText{}
elements can be deep lists of
characters and/or binaries.
RootAttributes
is a list of
[#xmlAttribute{}]
attributes for the #root#
element, which implicitly becomes the parent of the given
Content
. The tag-handler function for
#root#
is thus called with the complete exported data of
Content
. Root attributes can be used to specify
e.g. encoding or other metadata of an XML or HTML document.
The Callback
module should contain hook functions for
all tags present in the data structure. A hook function must have the
following format:
Tag(Data, Attributes, Parents, E)where
E
is the corresponding #xmlElement{}
,
Data
is the already-exported contents of E
and Attributes
is the list of
#xmlAttribute{}
records of E
. Finally,
Parents
is the list of parent nodes of E
,
on the form [{ParentTag::atom(),
ParentPosition::integer()}]
.
The hook function should return either the data to be exported, or
a tuple {'#xml-alias#', NewTag::atom()}
, or a tuple
{'#xml-redefine#', Content}
, where Content
is a content list (which can be on simple-form; see
export_simple/2
for details).
A callback module can inherit definitions from other callback
modules, through the required function '#xml-interitance#() ->
[ModuleName::atom()]
.
See also: export/2, export_simple/3.
Exports normal XML content directly, without further context.
Exports a normal XML element directly, without further context.
export_element(E, CBs, UserState) -> ExportedFormat
For on-the-fly exporting during parsing (SAX style) of the XML document.
export_simple(Content, Callback) -> ExportedFormat
Equivalent to export_simple(Data, Callback, []) .
export_simple(Content, Callback, RootAttributes) -> ExportedFormat
Exports "simple-form" XML content, using the specified
callback-module.
Element
is any of:
{Tag, Attributes, Content}
{Tag, Content}
Tag
IOString
#xmlText{}
#xmlElement{}
#xmlPI{}
#xmlComment{}
#xmlDecl{}
Tag = atom()
Attributes = [{Name, Value}]
Name = atom()
Value = IOString | atom() | integer()
IOString
is a (possibly deep) list of characters and/or
binaries.
See export/3
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.
See also: export/3, export_simple/2.