fast_xml
fast_xml copied to clipboard
Is there an option to disable nesting into text elements containing HTML?
Hi,
I'm probably missing somehing but I am trying to figure out if it is possible to consider the body of a particular element as sometihng that does not need to be nested into (as is done in the below example with the granular tokenizing of the HTML elements inside the "body" element). I can see the logic for the outcome I'm getting but if I would like it just as one big CDATA is there any way I can specify that?
My goal is to simply extract the "body" as one erlang binary.
Thanks,
7> fxml_stream:parse_element(<<"<message><body>?OTRv2?\n<b>[email protected]</b> has requested an <a href=\"http://otr.cypherpunks.ca/\">Off-the-Record private conversation</a>. However, you do not have a plugin to support that.\nSee <a href=\"http://otr.cypherpunks.ca/\">http://otr.cypherpunks.ca/</a> for more information.</body></message>">>).
{xmlel,<<"message">>,[],
[{xmlel,<<"body">>,[],
[{xmlcdata,<<"?OTRv2?\n">>},
{xmlel,<<"b">>,[],[{xmlcdata,<<"[email protected]">>}]},
{xmlcdata,<<" has requested an ">>},
{xmlel,<<"a">>,
[{<<"href">>,<<"http://otr.cypherpunks.ca/">>}],
[{xmlcdata,<<"Off-the-Record private conversation">>}]},
{xmlcdata,<<". However, you do not have a plugin to support that"...>>},
{xmlel,<<"a">>,
[{<<"href">>,<<"http://otr.cypherpunks.ca/">>}],
[{xmlcdata,<<"http://otr.cypherpunks.ca/">>}]},
{xmlcdata,<<" for more information.">>}]}]}
You cannot extract XML tags as binary blobs using fast_xml.