Skip to content

Support multiple prop names for cdata wrapping #751

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

Open
mohas opened this issue May 24, 2025 · 2 comments
Open

Support multiple prop names for cdata wrapping #751

mohas opened this issue May 24, 2025 · 2 comments

Comments

@mohas
Copy link

mohas commented May 24, 2025

Currently cdataPropName only accepts a single key, but in many cases for example in rss we have title and description that both needs to be wrapped, so it is reasonable (and required with rss for example) to be able to use an array of keys for this prop.
see rss of bbc: https://feeds.bbci.co.uk/news/rss.xml

Copy link

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.

@mohas
Copy link
Author

mohas commented May 24, 2025

figured it out:

instead of:

type RssChannel = {
  title: string
}

made it into:

type RssChannel = {
  title: CData
}
type CData = {
  wrappedValue: string
}

let channel = {
title: {wrappedValue: 'something'}

new Response(new XMLBuilder({
      cdataPropName: 'wrappedValue',
    })

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

No branches or pull requests

1 participant