processone / processone/fast_xml

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

Open
#31 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Erlang
Stars
137
Forks
44
Avg merge
3d 57m
Merged PRs (30d)
1

Description

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.">>}]}]}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the fxml_stream:parse_element/1 entry point shown in the issue and trace how nested elements inside text content are represented. Determine whether an option can preserve the body as one Erlang binary, then verify that the chosen behavior is covered by parser tests; the issue does not name specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.