cburgmer / xmlserializer

xmlserializer serializes a DOM subtree or DOM document into XML/XHTML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tags name converts to lowercase

anurag143 opened this issue · comments

it seems xmlserializer.serializeToString() changes the case of tags to lowercase in the xml. I found this issue while converting svg to canvas and using xmlserializer between the process. While conversion, the color of the svg image turned black. After inspecting the serialized string I found tags were reduced to lowercase. So I have removed toLowerCase() function from line number 48 & 66 at my end and its working fine. This is just for your information and hope that this change won't effect the overall functionality of the script.

Thanks for the report. xmlserializer does change the letter case, to aid in conversion from HTML to XHTML. This is pretty specific and should probably not be done by default.

We will probably need to separate the lowercase conversion from the serialization process.

Can you provide an example SVG where this breaks? So far I've assumed that all XML-based standards from the W3C do use lowercase only.

Hi,
Following svg
'0102030405060Samir WattarJim TrippleMichael MabryWill MacIntosh65%60%65%60%'
produces
svg_image
and
'0102030405060Samir WattarJim TrippleMichael MabryWill MacIntosh65%60%65%60%'
produces this one
svg_image_black
you can see tags like 'linearGredient' are lower cased. I don't know this is an issue with your js or the canvg js I am using to convert svg to canvas. But removing toLowerCase() function resolved my issue.

Let me know if that works for you. I am going to make a bug fix release also.

Thanks for the quick turn around.