.TH xmerl 3erl "xmerl 1.3.31.1" "" "Erlang Module Definition" .SH NAME 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(Module) -> Result .br .RS .LP Types: .RS 3 Module = atom() .br Result = [atom()] .br .RE .RE .RS .LP Find the list of inherited callback modules for a given module\&. .RE .LP .B export(Content, Callback) -> ExportedFormat .br .RS .LP Equivalent to export(Data, Callback, [])\&. .RE .LP .B export(Content, Callback, RootAttributes) -> ExportedFormat .br .RS .LP Types: .RS 3 Content = [Element] .br Callback = atom() .br RootAttributes = [XmlAttributes] .br .RE .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\& .LP .TP 2 * \fI#xmlElement{}\fR\& .LP .TP 2 * \fI#xmlPI{}\fR\& .LP .TP 2 * \fI#xmlComment{}\fR\& .LP .TP 2 * \fI#xmlDecl{}\fR\& .LP .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: .LP .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, Callbacks) -> term() .br .RS .LP Types: .RS 3 Content = [Element] .br Callback = [atom()] .br .RE .RE .RS .LP Exports normal XML content directly, without further context\&. .RE .LP .B export_element(E, CB) -> term() .br .RS .LP Exports a normal XML element directly, without further context\&. .RE .LP .B export_element(E, CallbackModule, CallbackState) -> ExportedFormat .br .RS .LP For on-the-fly exporting during parsing (SAX style) of the XML document\&. .RE .LP .B export_simple(Content, Callback) -> ExportedFormat .br .RS .LP Equivalent to export_simple(Content, Callback, [])\&. .RE .LP .B export_simple(Content, Callback, RootAttrs::RootAttributes) -> ExportedFormat .br .RS .LP Types: .RS 3 Content = [Element] .br Callback = atom() .br RootAttributes = [XmlAttributes] .br .RE .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\& .LP .TP 2 * \fI{Tag, Content}\fR\& .LP .TP 2 * \fITag\fR\& .LP .TP 2 * \fIIOString\fR\& .LP .TP 2 * \fI#xmlText{}\fR\& .LP .TP 2 * \fI#xmlElement{}\fR\& .LP .TP 2 * \fI#xmlPI{}\fR\& .LP .TP 2 * \fI#xmlComment{}\fR\& .LP .TP 2 * \fI#xmlDecl{}\fR\& .LP .RE .LP where .RS 2 .TP 2 * \fITag = atom()\fR\& .LP .TP 2 * \fIAttributes = [{Name, Value}]\fR\& .LP .TP 2 * \fIName = atom()\fR\& .LP .TP 2 * \fIValue = IOString | atom() | integer()\fR\& .LP .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\& .LP .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(Content, Callback) -> term() .br .RS .LP Exports simple XML content directly, without further context\&. .RE .LP .B export_simple_element(Content, Callback) -> term() .br .RS .LP Exports a simple XML element directly, without further context\&. .RE .SH AUTHORS .LP .I <>