From: Øyvin Halfdan Thuv
Subject: Writing xhtml tags with Closure XML
Date: 
Message-ID: <slrnfrldn7.p14.oyvinht@decibel.pvv.ntnu.no>
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 &lt;b&gt;lot&lt;/b&gt;!</test>"

That is, all tags in the text are escaped. Does anyone know how to preserve
the tags?

-- 
Oyvin

From: ···@crispylogics.com
Subject: Re: Writing xhtml tags with Closure XML
Date: 
Message-ID: <03488238-c923-4993-a9cd-6232f4a1c461@q78g2000hsh.googlegroups.com>
On 19 Feb., 12:00, Øyvin Halfdan Thuv <·······@localhost.localdomain>
wrote:
> 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 &lt;b&gt;lot&lt;/b&gt;!</test>"
>
> That is, all tags in the text are escaped. Does anyone know how to preserve
> the tags?

How about
(with-xml-output (make-string-sink :indentation 2 :canonical nil)
  (with-element "test"
    (text "test a")
    (with-element "b"
      (text "lot"))
    (text "!")))
==>
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>

<test>
  test a
  <b>
    lot</b>
  !
</test>"

--
Jochen Schmidt
Crispy Logics
Julienstr. 1, 90419 Nuremberg

Fon +49 (0)911 517 999 82
Fax +49 (0)911 517 999 83

mailto: (format nil "~(····@~36r.~36r~)" 870180 1680085828711918828
16438)
http://www.crispylogics.com
From: David Lichteblau
Subject: Re: Writing xhtml tags with Closure XML
Date: 
Message-ID: <slrnfrlish.af3.usenet-2006@radon.home.lichteblau.com>
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.
From: Øyvin Halfdan Thuv
Subject: Re: Writing xhtml tags with Closure XML
Date: 
Message-ID: <slrnfrlkfn.jo9.oyvinht@decibel.pvv.ntnu.no>
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