iVis-at-Bilkent / cytoscape.js-graphml

A Cytoscape.js extension to import from and export to GraphML format
MIT License
31 stars 8 forks source link

Special characters are not encoded #6

Closed sveinp closed 7 years ago

sveinp commented 8 years ago

When generating XML, special XML characters in XML (&,<,>,") are not encoded properly, leading to invalid XML.

Either pack all values into CDATA or check/replace the special characters - something like:

function escapeXml(unsafe) { return unsafe.replace(/[<>&'"]/g, function (c) { switch (c) { case '<': return '<'; case '>': return '>'; case '&': return '&'; case '\'': return '''; case '"': return '"'; } }); }

ugurdogrusoz commented 8 years ago

@sveinp Thanks! Could you please make the necessary changes and make a pull request for it?

metincansiper commented 7 years ago

I merged the related PR. I am closing the issue for now. Please let me know if there is any problem.