[erlang-questions] xmerl: from tuple to xmerl data structure
Richard Carlsson
richardc@REDACTED
Fri Jun 29 09:38:11 CEST 2007
Ludovic Coquelle wrote:
> Hi,
> Just start to "play" with xmerl. I'm using the xmerl:export_simple/3
> to transform an erlang data structure in an XML document. Works
> nicely.
>
> Now, I would like to transform the same erlang data structure to the
> xmerl data structure (xmlElement...), to eventually use the xmerl_xs
> on it.
> Is there a simple way to do that?
Yes, these functions are exported from the xmerl_lib module (which is
not documented, but it seems that it probably should be):
expand_content/1, normalize_content/1,
expand_element/1, normalize_element/1,
expand_attributes/1
The difference between normalize and expand is that the normalize
functions also flatten all text strings in the representation, which is
useful when you want to search the tree for specific strings.
/Richard
More information about the erlang-questions
mailing list