xmlfmt
xmlfmt copied to clipboard
cdata
Ciao,
I try to format this string but receive a panic.
"<book><author>Fred</author><text><![CDATA[<message> Welcome to xmlfmt </message>]]></text><isbn>23456</isbn></book>"
Yeah, that day has come -- I was hoping that people would not be dealing with CDATA, but the day has finally come.
I meant, the xml CDATA is very convoluted to me, and I had no idea how to deal it, even up till today.
If the RE matching is not complicated enough for you, would you care to send in a PR pls?
One idea is to change the CDATA to comment before feeding to RE matching, then change it back afterwards. However, I do not know xml CDATA syntax well enough to know if it'll theoretically work.
You can try that kind of data massages on your side before calling xmlfmt if you want, before a proper fix can be done to this lib.
Ciao,
I'm sorry but I don't have the skills to help you.
Il giorno 14 nov 2022, alle ore 23:10, AntonioSun @.***> ha scritto:
Yeah, that day has come -- I was hoping that people would not be dealing with CDATA, but the day has finally come.
I meant, the xml CDATA is very convoluted to me, and I had no idea how to deal it, even up till today.
If the RE matching is not complicated enough for you, would you care to send in a PR pls?
— Reply to this email directly, view it on GitHub https://github.com/go-xmlfmt/xmlfmt/issues/8#issuecomment-1314474354, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADIGU74QOFFMM6GLHMDMLKLWIK2EDANCNFSM6AAAAAASAI2VSA. You are receiving this because you authored the thread.
Closing as the xml CDATA is too convoluted for me to grasp -- recommend to use external tools to change the CDATA to comment before feeding to xmlfmt.