Skip to content

Support for marshalling CDATA content #173

Closed

Description

@jahow

Hi,

Is it possible to set up a schema so that a string will be marshalled as <![CDATA[...]]> in the resulting XML?
If not, is this something planned or open to contribution?

Thanks for your work

Activity

  1. highsource commented on Jun 1, 2017

    @highsource
    Owner

    Not at the moment. Technically there is no difference between a string and CDATA wrapping.
    Open for contribution, sure. I think this can be solved with a custom simple type.

  2. jahow commented on Jun 2, 2017

    @jahow
    ContributorAuthor

    Actually the tricky part is to avoid encoding of special characters, which mean using document.createCDATASection instead of document.createTextNode in Output.js.

    I'll try to make a PR for this as it would be much cleaner than hacking it with a custom type or a string replace.

    Thanks!

  3. added a commit that references this issue on Jun 21, 2017
  4. highsource commented on Jun 21, 2017

    @highsource
    Owner

    I've made a few minor changes. Mainly to check that if the text contains ]]> it must be split in two CDATA sections as CDATA section can't contain ]]>.
    Also used cdata as laconic form for asCDATA.

    Apart from that everything was fine. Thank you for your contribution!

    Please check if the latest changes are fine for you.

  5. jahow commented on Jun 22, 2017

    @jahow
    ContributorAuthor

    Perfect! Glad I could help improve the library. Thanks for documenting the feature.

  6. self-assigned this
    on Mar 18, 2019
  7. added this to the 2.4.2 milestone on Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions