Hi.
For the Closure XML dependent code:
(with-xml-output (make-string-sink :indentation 2 :canonical nil)
(with-element "test"
(text "test a <b>lot</b>!")))
The output will be:
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<test>
test a <b>lot</b>!</test>"
That is, all tags in the text are escaped. Does anyone know how to preserve
the tags?
--
Oyvin
Hi,
On 2008-02-19, ?yvin Halfdan Thuv <·······@localhost.localdomain> wrote:
> (with-xml-output (make-string-sink :indentation 2 :canonical nil)
> (with-element "test"
> (text "test a <b>lot</b>!")))
[...]
> That is, all tags in the text are escaped.
right, that's what CXML:TEXT (a convenience function for SAX:CHARACTERS)
will do.
> Does anyone know how to preserve the tags?
For the few cases where it's actually necessary to write unescaped
characters into the output, the CVS version of cxml has a new SAX event
SAX:UNESCAPED and convenience function CXML:UNESCAPED:
CXML> (with-xml-output (make-string-sink :canonical nil)
(with-element "test"
(unescaped "test a <b>lot</b>!")))
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<test>test a <b>lot</b>!</test>"
It's not a feature I would use very often, but XSLT allows this kind of
thing, so I decided to add an exported interface for it after all.
(The next tarball release of cxml including these changes will be in a
month or so. Until then, you can check it out from CVS as explained in
the download section of cxml's project page.)
d.
On 2008-02-19, David Lichteblau <···········@lichteblau.com> wrote:
> Hi,
>
> On 2008-02-19, ?yvin Halfdan Thuv <·······@localhost.localdomain> wrote:
>> (with-xml-output (make-string-sink :indentation 2 :canonical nil)
>> (with-element "test"
>> (text "test a <b>lot</b>!")))
> [...]
>> That is, all tags in the text are escaped.
>
> right, that's what CXML:TEXT (a convenience function for SAX:CHARACTERS)
> will do.
>
>> Does anyone know how to preserve the tags?
>
> For the few cases where it's actually necessary to write unescaped
> characters into the output, the CVS version of cxml has a new SAX event
> SAX:UNESCAPED and convenience function CXML:UNESCAPED:
>
> CXML> (with-xml-output (make-string-sink :canonical nil)
> (with-element "test"
> (unescaped "test a <b>lot</b>!")))
> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
><test>test a <b>lot</b>!</test>"
Aha. Great.
>
> It's not a feature I would use very often, but XSLT allows this kind of
> thing, so I decided to add an exported interface for it after all.
I want to include marked-up text into an XML-document. For this case such
functionallity is useful (with the danger of including non-conformant XML, of
course).
> (The next tarball release of cxml including these changes will be in a
> month or so. Until then, you can check it out from CVS as explained in
> the download section of cxml's project page.)
OK. Thanks!
--
Oyvin