[erlang-questions] Problem with xmerl - xml parsing

Steve Davis <>
Wed Apr 1 14:27:32 CEST 2009

HI Sreenivasan,

Perhaps the biggest issue here is that, in XML, space preservation is
only defined for the element values/content, not for attributes. It
may help to review the XML specs particularly the definition of
attribute values, and then you'll understand that erlang's xmerl is,
in fact, working correctly.


On Apr 1, 5:30 am, Sreenivasan K <>
> Hi,
> \n problem in xml file .
> This is my xml file (test.xml)
> <tests>
> <test method="one
>         two
>         three"></test>
> </tests>
> This is my erlang file test_parse.erl
> -module(test_parse).
> -compile(export_all).
> start()->
>     Data=xmerl_scan:file("test.xml",[{encoding,"utf-8"}]),
>     io:format("~p~n",[Data]).
> this is the output i got when i run the program
> >test_parse:start().
> Out put is the xmlElement recort and for the string in xml file it is
> parsing as "one    two     three" but this i had not expected i
> experted \n in between one ,two and three. . And one more point i cant
> put \n inside the string if i put \n in between the strings it parser
> and displays as "\\n" i need only one \n is there is any way to put \n
> inside the string .
> _______________________________________________
> erlang-questions mailing list
> ://www.erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list