Skip to content

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

@gardenia

Description

@gardenia

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>bob@acme.com</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,<<"bob@acme.com">>}]},
                {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.">>}]}]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions