-
Notifications
You must be signed in to change notification settings - Fork 55
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
Added CDATA support to the toString() #23
Conversation
For complex values that contain '<', '>', or '&', support CDATA construct if opts.cdata is true.
* Attributes are not %-encoded, they should be escaped the same way as xml elements. * The & must be escaped first, or else you double escape the elements with value like "<" into "&lt;" http://www.liquid-technologies.com/XML/EscapingData.aspx
👍 |
@nfarina, @wotzisname - is there anything wrong with this PR? |
Sorry it took me so long to review this! I think this looks great for the most part. I like the new It looks like CDATA tags are output "automatically" when requested in options based on the presence of characters like |
@nfarina thanks for the review. For my usecase, I need to force various elements to cdata (silly mapnik lib has weird xml parsing rules). But for general use, sure, it might be good to allow both. |
You could control which elements are exported as CDATA by setting |
might be a bit difficult - take a look - https://github.com/kartotherian/osm-bright.tm2source/blob/master/data.xml - for example, all params are cdata |
Are you generating this XML from scratch? Or parsing an existing document? If you're parsing an existing document, then |
i parse it in and alter a few values |
So when you parse CDATA tags does it correctly "round-trip" them back to the |
For complex values that contain '<', '>', or '&',
support CDATA construct if opts.cdata is true.