Я предлагаю вам использовать xmerl
. Сохраните xml в файл с именем t.xml
. 1
1> {ParsResult,Misc}=xmerl_scan:file("t.xml").
{{xmlElement,message,message,[],
{xmlNamespace,[],[]},
[],1,
[{xmlAttribute,to,[],[],[],
[{message,1}],
1,[],"XXXX@chat.XYZ.com",false},
{xmlAttribute,id,[],[],[],
[{message,1}],
2,[],"v0k4h-128",false},
{xmlAttribute,type,[],[],[],
[{message,1}],
3,[],"chat",false}],
[{xmlText,[{message,1}],1,[],"\n ",text},
{xmlElement,body,body,[],
{xmlNamespace,[],[]},
[{message,1}],
2,[],
[{xmlText,[{body,2},{message,1}],1,[],"Hi",text}],
[],".",undeclared},
{xmlText,[{message,1}],3,[],"\n ",text},
{xmlElement,request,request,[],
{xmlNamespace,'urn:xmpp:receipts',[]},
[{message,1}],
4,
[{xmlAttribute,xmlns,[],[],[],[...],...}],
[],[],".",undeclared},
{xmlText,[{message,1}],5,[],"\n ",text},
{xmlElement,customInfo,customInfo,[],
{xmlNamespace,'urn:xmpp:customInfo',[]},
[{message,1}],
6,
[{xmlAttribute,xmlns,[],[],...}],
[{xmlText,[{...}|...],1,...},
{xmlElement,customElement1,...},
{xmlText,...},
{...}|...],
[],".",undeclared},
{xmlText,[{message,1}],7,[],"\n",text}],
[],".",undeclared},
[]}
2>
1