[Monetdb-developers] Q: pathfinder output of CDATA
With bzv.xq: <abstract><![CDATA[Kijkers van het populaire programma <i>Boer zoekt vrouw</i>]]></abstract> as query, I get result MapiClient -lx bzv.xq <?xml version="1.0" encoding="utf-8"?> <XQueryResult><abstract>Kijkers van het populaire programma <i>Boer zoekt vrouw</i></abstract></XQueryResult> How do I get the <i> instead of <i>? (I know how to do this with fn:replace, but guess there must be an output directive?) Cheers, Arjen -- ==================================================================== CWI, room C1.16 Centre for Mathematics and Computer Science Kruislaan 413 Email: Arjen.de.Vries@cwi.nl 1098 SJ Amsterdam tel: +31-(0)20-5924306 The Netherlands fax: +31-(0)20-5924312 ===================== http://www.cwi.nl/~arjen/ ====================
(re-trying bounced msg with different From) With bzv.xq: <abstract><![CDATA[Kijkers van het populaire programma <i>Boer zoekt vrouw</i>]]></abstract> as query, I get result MapiClient -lx bzv.xq <?xml version="1.0" encoding="utf-8"?> <XQueryResult><abstract>Kijkers van het populaire programma <i>Boer zoekt vrouw</i></abstract></XQueryResult> How do I get the <i> instead of <i>? (I know how to do this with fn:replace, but guess there must be an output directive?) Cheers, Arjen -- ==================================================================== CWI, room C1.16 Centre for Mathematics and Computer Science Kruislaan 413 Email: Arjen.de.Vries@cwi.nl 1098 SJ Amsterdam tel: +31-(0)20-5924306 The Netherlands fax: +31-(0)20-5924312 ===================== http://www.cwi.nl/~arjen/ ==================== -- ==================================================================== CWI, room C1.16 Centre for Mathematics and Computer Science Kruislaan 413 Email: Arjen.de.Vries@cwi.nl 1098 SJ Amsterdam tel: +31-(0)20-5924306 The Netherlands fax: +31-(0)20-5924312 ===================== http://www.cwi.nl/~arjen/ ====================
On Wed, Jan 03, 2007 at 12:09:44AM +0100, Arjen P. de Vries wrote:
With bzv.xq: <abstract><![CDATA[Kijkers van het populaire programma <i>Boer zoekt vrouw</i>]]></abstract> as query,
I get result MapiClient -lx bzv.xq
<?xml version="1.0" encoding="utf-8"?> <XQueryResult><abstract>Kijkers van het populaire programma <i>Boer zoekt vrouw</i></abstract></XQueryResult>
How do I get the <i> instead of <i>? (I know how to do this with fn:replace, but guess there must be an output directive?)
Hi Arjen, this is expected behavior. XML/XQuery's CDATA construct is syntactic sugar that can be used to avoid lots of escaping with entity references. So <foo><![CDATA[bar]]></foo> and <foo>bar</foo> are exactly the same thing in XML. But within CDATA sections, you don't have to escape any special character. <foo><![CDATA[foo & bar]]></foo> and <foo>foo & bar</foo> are, again, the exact same thing in XML. Similarly, you can write angle brackets within CDATA sections without escaping them. What you probably want in your case is not to use CDATA at all, but just regular XML content, i.e., <abstract>Kijkers van het populaire programma <i>Boer zoekt vrouw</i></abstract> By the way, you can *not* avoid the escaping of angle brackets with fn:replace. Written as a string in the C programming language, e.g., the content of your original <abstract> element is "Kijkers van het populaire programma <i>Boer zoekt vrouw</i>" (no "<" involved here). Upon serialization to XML, however, angle brackets need to be escaped, with the output you observed. Note that you could construct illegal XML otherwise. Regards from Bavaria Jens -- Jens Teubner Technische Universitaet Muenchen, Department of Informatics D-85748 Garching, Germany Tel: +49 89 289-17259 Fax: +49 89 289-17263 Please avoid sending me MS Word, MS Excel or MS PowerPoint files. Why? See http://www.fsf.org/philosophy/no-word-attachments.html
Hi Jens, Thanks for a clear answer! I work with a corpus where people used the CDATA, so I guess there is no way around but convert it first to get the desired behaviour in generating formatted HTML output. Meanwhile, with fn:replace I can at least remove the <i> etc., so display is unformatted HTML plain text. Thanks, Arjen | Hi Arjen, | | this is expected behavior. XML/XQuery's CDATA construct is syntactic | sugar that can be used to avoid lots of escaping with entity references. | So | | <foo><![CDATA[bar]]></foo> | | and | | <foo>bar</foo> | | are exactly the same thing in XML. But within CDATA sections, you don't | have to escape any special character. | | <foo><![CDATA[foo & bar]]></foo> | | and | | <foo>foo & bar</foo> | | are, again, the exact same thing in XML. Similarly, you can write angle | brackets within CDATA sections without escaping them. | | What you probably want in your case is not to use CDATA at all, but just | regular XML content, i.e., | | <abstract>Kijkers van het populaire programma <i>Boer zoekt vrouw</i></abstract> | | | By the way, you can *not* avoid the escaping of angle brackets with | fn:replace. Written as a string in the C programming language, e.g., | the content of your original <abstract> element is | | "Kijkers van het populaire programma <i>Boer zoekt vrouw</i>" | | (no "<" involved here). Upon serialization to XML, however, angle | brackets need to be escaped, with the output you observed. Note that | you could construct illegal XML otherwise. | | Regards from Bavaria | | Jens | | -- | Jens Teubner | Technische Universitaet Muenchen, Department of Informatics | D-85748 Garching, Germany | Tel: +49 89 289-17259 Fax: +49 89 289-17263 | | Please avoid sending me MS Word, MS Excel or MS PowerPoint files. | Why? See http://www.fsf.org/philosophy/no-word-attachments.html | | ------------------------------------------------------------------------- | Take Surveys. Earn Cash. Influence the Future of IT | Join SourceForge.net's Techsay panel and you'll get the chance to share your | opinions on IT & business topics through brief surveys - and earn cash | http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV | _______________________________________________ | Monetdb-developers mailing list | Monetdb-developers@lists.sourceforge.net | https://lists.sourceforge.net/lists/listinfo/monetdb-developers |
participants (3)
-
Arjen P. de Vries
-
Arjen P. de Vries
-
Jens Teubner