lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


(This isn't aimed at Laurent--I am just confused.)

On Feb 21, 2012 5:44 PM, "Laurent FAILLIE" <l_faillie@yahoo.com> wrote:

> So, I found the better solution with is to embed the response inside CDATA tags which avoid any change in the response message.

Unless the string contains "]]>" of course.

There is no way to avoid escaping arbitrary strings included in XML documents.

> I suggest to patch luasoap to make developer life easier :)

Through the life of this thread I've completely lost track of what
LuaSoap actually does for me. As of 3.0 it appears it will correctly
marshal LOM into XML; what else is needed?

CDATA is just another escape mechanism. The choice between it and
&lt/&amp escaping is a matter of coding efficiency. CDATA has higher
overhead but after the third escaped entity it's more
efficient--unless your text has many more "]]>" sequences than "<" and
"&". This is the kind of thing a good XML library should handle for
me: getting this right once, so I just don't naively strsub every time
I need output. A heuristic of "use CDATA if the string starts with '<'
and is longer than ten characters" is a good start, as is a population
count of [&<] of the first hundred characters.

There are a couple other things I want in an XML output library,
starting with...UTF-8 validity, and barring invalid codepoints.

Jay