Xml messaging in erlang question

Willem de Jong w.a.de.jong@REDACTED
Thu Aug 24 21:20:31 CEST 2006


You would need
1. an http server module that accepts the HTTP post in chunks, and passes it on
to the XML parser in chunks.

2. an XML parser that can work on chunks of data

3. the XML parser should probably be a SAX parser: one that generates
events as it parses the XML document

4. the module that processes the SAX events should be able to discard the
bits that you don't need.

Like Joe says, it is not 100% clear whether you need 1 and 2 to avoid holding
the XML document in memory while processing it.

Looking at what is available:
ad 1)
It is not clear to me whether YAWS and/or Inets can deliver the post
data in chunks.

ad 2)
I believe that Xmerl can work on chunks of data (using the
'continuation' function
to get the next chunk)

ad 3)
xmerl and erlsom both offer a SAX API

ad 4)
erlsom could probably be used to discard the events that you don't need.

You would have to write an XSD for the XML document (maybe it already exists).
If you define the elements that you dont want as 'any' element, and you set
the 'processContents' attribute to 'skip', then erlsom will discard
these elements.

Note that the additional benefit is that the XML document will be transformed to
a structure of Erlang records (following the types as defined in the
XSD). This is
convenient for processing, and it takes much less space than a DOM
representation.

This is of course just a shameless attempt to draw some attention for erlsom
(www.sourceforge.org/projects/erlsom), a nice tool that I have been writing
that deserves some attention...

Regards,
Willem



More information about the erlang-questions mailing list