xmlfmt icon indicating copy to clipboard operation
xmlfmt copied to clipboard

cdata

Open FrankIT60 opened this issue 3 years ago • 3 comments
trafficstars

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>"

FrankIT60 avatar Nov 14 '22 21:11 FrankIT60

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?

AntonioSun avatar Nov 14 '22 22:11 AntonioSun

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.

AntonioSun avatar Nov 14 '22 22:11 AntonioSun

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.

FrankIT60 avatar Nov 15 '22 11:11 FrankIT60

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.

AntonioSun avatar Nov 28 '24 23:11 AntonioSun