I'm trying to extract text from an xml node using Erlang's xmerl_xpath
:
[include "xmerl.hrl"]
{Doc, _}=xmerl_scan:string("<node>Hello World</node>").
[#xmlText{value=Text}]=xmerl_xpath:string("//node/text()", Doc).
Text.
"Hello World"
Works fine for this simple example. Problem occurs when the text in the node element is very large, say 1MB; xmerl_scan:string works fine [ie the document parses okay], but trying to extract the text produces this error:
{{badmatch,[{xmlText,[{node,1}],1,[],"[large text here]"}]}}
I thought maybe
a) xmerl_scan:string produces a different document structure when the text size is very large
b) I've reached some kind of limit for the Erlang string length
Any ideas what might be happening ?
Thanks