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

Parser is not able to parse the <![CDATA[ #519

Open
Abhishek2kr opened this issue Aug 23, 2019 · 8 comments
Open

Parser is not able to parse the <![CDATA[ #519

Abhishek2kr opened this issue Aug 23, 2019 · 8 comments

Comments

@Abhishek2kr
Copy link

Abhishek2kr commented Aug 23, 2019

So there should be option so that we can pass for parsing the multiple <![CDATA[

@Abhishek2kr Abhishek2kr changed the title In case of more than once <![CDATA[ inside XML, Parser is not able to parse the child <![CDATA[ Parser is not able to parse the <![CDATA[ Aug 23, 2019
@knoxcard
Copy link

knoxcard commented Sep 3, 2019

Are you using the most recent version of xml2js?

Yarn

yarn upgrade xml2js

NPM

npm update xml2js

Please confirm when possible....thanks!

@t0lik
Copy link

t0lik commented Sep 4, 2019

Are you using the most recent version of xml2js?

Only the builder has this option but not the parser

@knoxcard
Copy link

knoxcard commented Sep 4, 2019

@Abhishek2kr - you gave my answer a thumbs up, did that work for you?
Please let us know when you can...

If all good, please close issue...

Thanks!

@Abhishek2kr
Copy link
Author

Abhishek2kr commented Sep 4, 2019

My npm version is 6.4.1 I have not updated the npm. And the xml2js version is 0.4.4

@knoxcard
Copy link

knoxcard commented Sep 4, 2019

npm update xml2js - should just update xml2js, not npm itself...

https://stackoverflow.com/questions/43127863/node-update-a-specific-package

@Abhishek2kr
Copy link
Author

Abhishek2kr commented Sep 4, 2019

I have just updated the xml2js still not working. I think we should create option for parser, similar to cdata option used in builder.

@mwillbanks
Copy link

I was running into this as well, I was looking to make a PR for this but don't have time yet... If you include this in the parser options, it will remove it, note the indexOf is really there for performance reasons since most xml feeds don't use cdata on all attributes.

  valueProcessors: [
    (value) => {
      if (value.indexOf('<![CDATA[') !== -1) {
        return value.replace(/\<\!\[CDATA\[([\s|\S]*)\]\]\>/i, "$1");
      }
      return value;
    },
  ]

@anouarElazzaouy
Copy link

it's handled in the last versions, all need to do is to update the package

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

5 participants