On 10/25/2016 11:21 AM, Peter S. Shenkin wrote: > Hi, Hongbin, > > Thanks. Indeed. svg2.svg, when renamed to svg2.html, shows the correct > image in Chrome. svg.html shows garbage. > > Still, it would be good to be able to create a real .svg file from RDKit.
OK, you made me look and I learned something today. Mozilla claims valid SVG must include the namespace declarations (https://developer.mozilla.org/en-US/docs/Web/SVG/FAQ) citing this document: https://jwatt.org/svg/authoring/#namespace-binding There it states """ <svg xmlns="http://www.w3.org/2000/svg" ... Be careful not to type xmlns:svg instead of just xmlns when you bind the SVG namespace. This is an easy mistake to make, but one that can break everything. Instead of making SVG the default namespace, it binds it to the namespace prefix 'svg', and this is almost certainly not what you want to do in an SVG file. A standards compliant browser will then fail to recognise any tags and attributes that don't have an explicit namespace prefix (probably most if not all of them) and fail to render your document as SVG. """ Sure enough, rdkit's files start with """ <svg:svg version='1.1' baseProfile='full' xmlns:svg='http://www.w3.org/2000/svg' ... """ With that declaration any standards-compliant viewer should only recognize tags with "svg:" prefix, and removing svg:'s results in a technically invalid file. Anything that displays it as an image is what we "it professionals" call b0rk3d. According to this, what RDKit writes out is wrong: you actually *want to* remove :svg from the root tag's "xmlns" attribute, then you *may* remove the svg: prefixes from all tags (including the root one). Of course, that was last edited in 2007, maybe something changed in the 10 years since. HTH, -- Dimitri Maziuk Programmer/sysadmin BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss