[XML-SIG] Utility functions (was: XBEL DTD as a meta-dtd)
Andrew M. Kuchling
Mon, 21 Sep 1998 18:08:18 -0400 (EDT)
Lars Marius Garshol writes:
> return string.replace(string.replace(str,'&',"&"),"<","<")
According to section 2.4 of the spec, > also needs to be
escaped as > when it's preceded by ]] ; ]]> needs to be ]]>.
It's probably simplest to always escape > as >, even when it's not
>Here is my XMLWriter (note that it is written for data-oriented
>documents, not document-like ones):
An interesting class. What do people think: should it be
added somewhere? One could obtain similar results by creating a DOM
tree and then linearising it, but that's also more complicated to
learn, so I don't think the XMLWriter class would be completely
redundant. On the other hand, perhaps it should be layered on top of
DOM, and if it turns out that most XML users know the DOM API anyway,
then XMLWriter really is redundant after all.
A.M. Kuchling http://starship.skyport.net/crew/amk/
You played me well, mortal. But I have played me for time out of mind. And I
do Robin Goodfellow better than anyone.
-- Robin Goodfellow, in SANDMAN #19: "A Midsummer Night's Dream"