Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there an option to disable nesting into text elements containing HTML? #31

Open
gardenia opened this issue Jan 21, 2018 · 1 comment
Labels

Comments

@gardenia
Copy link

gardenia commented Jan 21, 2018

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.">>}]}]}
@zinid
Copy link
Contributor

zinid commented Jan 21, 2018

You cannot extract XML tags as binary blobs using fast_xml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants