xmerl newlines

Fredrik Linder <>
Wed Jun 18 16:29:03 CEST 2003


> > I had implemented the {space,...} option wrongly in
> > xmerl-0.15 and was set straight by those who use and
> > understand XML. (: However, the option {space,normalize}
> > _should_ do almost what you want.  It will accumulate
> > consecutive whitespace and replace it with one space. Close
> > enough?
>
> I did not know that this option existed. I had not read the
> source well enough.
> This option makes it easier to pick out the parts of empty text
> and throw them out. Still, it would be easier if all xmlText
> records with empty text would be removed during parsing,
> especially if it has "siblings" that are xmlElement records. An
> option {space,remove} would be nice...
> Now I have a function that walks through the #xmlElement{} tree
> and throws out what is the result of pretty printing, which works
> well enough for me to not start hacking xmerl myself :)

Alternatively to traverse the #xmlElement{} tree after parsing you could
check this during parsing using the function hooks available in xmerl_scan.
Great addition!

You then will have the possiblity to change the whole tree if you so desire.

Good Luck
/Fredrik




More information about the erlang-questions mailing list