[erlang-questions] xmerl documentation

Edward Stow ed.stow@REDACTED
Tue Jan 6 07:17:18 CET 2009


I am having a hard time working my way through some simple xml
processing because I cannot understand the documentation.

Q. From the xmerl reference, one of the exports is

callbacks(M::atom()) -> [atom()]
    Find the list of inherited callback modules for a given module.

What does the double colon notation mean : M::atom() in the above?
What is the purpose of the function - what is an example of its usage.
I tried this:

31> xmerl:callbacks(xmerl).
** exception error: undefined function xmerl:'#xml-inheritance#'/0
     in function  xmerl:check_inheritance/2
     in call from xmerl:callbacks/1

32> xmerl:callbacks(xmerl_xml).

So what is the point?

Another example:

export_simple(Data::Content, Callback, RootAttrs::RootAttributes) ->


Content = [Element]
Callback = atom()
RootAttributes = [XmlAttributes]

Exports "simple-form" XML content, using the specified callback-module.

Q:  What are the atoms that can be used as the Callback.  They are not
defined in the reference manual.  From reading the tutorial and list
messages I know about xmerl_xml, and xmerl_html but have not seen any
definitions of the effect of these on the content.

Q:  What is ExportedFormat ?  AFAICT it is not defined in the reference manual.

27> Data.

28> xmerl:export_simple_content([Data], xmerl_xml).

29> lists:flatten(xmerl:export_simple_content([Data], xmerl_xml)).

Anoher examle:

export_simple_content(Data, Callback) -> term()

Exports simple XML content directly, without further context.

Comment:  A term() is any erlang data structure -- but a list is returned.

Comment: I would not call the output from this function  'simple XML
content', I was expecting a string.

Q.  What is the 'context' that this and many other functions in xmerl
can do without?

Sorry for so many questions in total frustration ....


Edward Stow

More information about the erlang-questions mailing list