[Monetdb-developers] Q: pathfinder - cdata
While <a /> is accepted as a query, <![CDATA[<]]> is not. !parse error: syntax error, unexpected " and failing 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/ ====================
Arjen P. de Vries wrote:
While <a /> is accepted as a query, <![CDATA[<]]> is not. !parse error: syntax error, unexpected
Is that the expected behaviour?
Context: I try to output email addresses as "test
" and failing Arjen
This works: xquery><a><![CDATA[<sjoerd@acm.org>]]></a> more><> <a><sjoerd@acm.org></a> -- Sjoerd Mullender
I have two followup questions then: 1. should <a><![CDATA[<sjoerd@acm.org>]]></a> not leave the CDATA intact and not replace the < to < ? Disclaimer: I am not very sure what should be correct. http://www.w3.org/TR/2003/WD-xslt-xquery-serialization-20030502/ states Note: This is phrased to permit an implementor to provide an option that attempts to preserve CDATA sections present in the source document. 2. Should xquery><![CDATA[<sjoerd@acm.org>]]></a> more>MAPI = monetdb@localhost:50000 QUERY = <![CDATA[<sjoerd@acm.org>]]></a> ERROR = !parse error: syntax error, unexpected wrote:
Arjen P. de Vries wrote:
While <a /> is accepted as a query, <![CDATA[<]]> is not. !parse error: syntax error, unexpected
Is that the expected behaviour?
Context: I try to output email addresses as "test
" and failing Arjen
This works:
xquery><a><![CDATA[<sjoerd@acm.org>]]></a> more><> <a><sjoerd@acm.org></a>
-- Sjoerd Mullender
-- ==================================================================== 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 07/12/2007 08:46 PM, Arjen P. de Vries wrote:
I have two followup questions then:
1. should <a><![CDATA[<sjoerd@acm.org>]]></a> not leave the CDATA intact and not replace the < to < ?
Disclaimer: I am not very sure what should be correct. http://www.w3.org/TR/2003/WD-xslt-xquery-serialization-20030502/ states Note: This is phrased to permit an implementor to provide an option that attempts to preserve CDATA sections present in the source document.
CDATA is CDATA, no matter the representation. In both cases the content of the <a> element is CDATA, it's just encoded differently. I doubt that there is a way for MonetDB/XQuery to find out which encoding was used.
2. Should xquery><![CDATA[<sjoerd@acm.org>]]></a> more>MAPI = monetdb@localhost:50000 QUERY = <![CDATA[<sjoerd@acm.org>]]></a> ERROR = !parse error: syntax error, unexpected
also have been allowed - a bit weird if it is allowed inside another element?
I don't know enough about XQuery, but my guess is: no. When you look at the XQuery grammar (http://www.w3.org/TR/xquery/#nt-bnf) you'll see that (after the optional prologue stuff) the query consists of a list of comma-separated ExprSingles, and that an ExprSingle is one of FLWORExpr, QuantifiedExpr, TypeswitchExpr, IfExpr, OrExpr. The only one (in a quick scan) that doesn't have to start with a keyword is OrExpr in the guise of a PathExpr. And the only CDataSection (<![CDATA[...]]>) is inside a <tag>...</tag> construct.
Cheers.
Arjen
On 12/07/07, Sjoerd Mullender
wrote: Arjen P. de Vries wrote:
While <a /> is accepted as a query, <![CDATA[<]]> is not. !parse error: syntax error, unexpected
Is that the expected behaviour?
Context: I try to output email addresses as "test
" and failing Arjen
This works:
xquery><a><![CDATA[<sjoerd@acm.org>]]></a> more><> <a><sjoerd@acm.org></a>
-- Sjoerd Mullender
-- Sjoerd Mullender
Thanks Sjoerd, Jens, that answers it.
Any suggestion how to achieve what I am really after?
I have an XML file with email addresses and names,
and want to output a text string with
"Name"
On 07/12/2007 08:46 PM, Arjen P. de Vries wrote:
I have two followup questions then:
1. should <a><![CDATA[<sjoerd@acm.org>]]></a> not leave the CDATA intact and not replace the < to < ?
Disclaimer: I am not very sure what should be correct. http://www.w3.org/TR/2003/WD-xslt-xquery-serialization-20030502/ states Note: This is phrased to permit an implementor to provide an option that attempts to preserve CDATA sections present in the source document.
CDATA is CDATA, no matter the representation. In both cases the content of the <a> element is CDATA, it's just encoded differently. I doubt that there is a way for MonetDB/XQuery to find out which encoding was used.
2. Should xquery><![CDATA[<sjoerd@acm.org>]]></a> more>MAPI = monetdb@localhost:50000 QUERY = <![CDATA[<sjoerd@acm.org>]]></a> ERROR = !parse error: syntax error, unexpected
also have been allowed - a bit weird if it is allowed inside another element?
I don't know enough about XQuery, but my guess is: no.
When you look at the XQuery grammar (http://www.w3.org/TR/xquery/#nt-bnf) you'll see that (after the optional prologue stuff) the query consists of a list of comma-separated ExprSingles, and that an ExprSingle is one of FLWORExpr, QuantifiedExpr, TypeswitchExpr, IfExpr, OrExpr. The only one (in a quick scan) that doesn't have to start with a keyword is OrExpr in the guise of a PathExpr. And the only CDataSection (<![CDATA[...]]>) is inside a <tag>...</tag> construct.
Cheers.
Arjen
On 12/07/07, Sjoerd Mullender
wrote: Arjen P. de Vries wrote:
While <a /> is accepted as a query, <![CDATA[<]]> is not. !parse error: syntax error, unexpected
Is that the expected behaviour?
Context: I try to output email addresses as "test
" and failing Arjen
This works:
xquery><a><![CDATA[<sjoerd@acm.org>]]></a> more><> <a><sjoerd@acm.org></a>
-- Sjoerd Mullender
-- Sjoerd Mullender
-- ==================================================================== 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/ ====================
Hi Arjen, If I understand you correctly you are interested in a 'text' output mode that does not escape any characters. Up to now every serialization mode in MXQ however escapes '"', '<', and '>'. A new (perhaps in some sense inconsistent) mode could avoid this escaping and in my eyes would mean only a small change to the serializer. Cheers, Jan On 07/12/2007 10:47 PM, Arjen P. de Vries wrote with possible deletions:
Thanks Sjoerd, Jens, that answers it.
Any suggestion how to achieve what I am really after?
I have an XML file with email addresses and names, and want to output a text string with "Name"
, "Name" , "Name" Now I use a web browser to convert <> into <>, but that cannot be the intention of using XQuery for your data management, could it?!
I found that http://www.gnu.org/software/qexo/Extensions.html introduces a special function - but is not standard.
Would the answer lie in a different output mode?
The serialization page (http://www.w3.org/TR/2003/WD-xslt-xquery-serialization-20030502/#N40063A) states: The text output method outputs the data model by outputting the string-value of every text node in the data model in document order without any escaping.
Any chance that MonetDB/XQ will support such a text output mode?
Cheers,
Arjen
On 12/07/07, Sjoerd Mullender
wrote: I have two followup questions then:
1. should <a><![CDATA[<sjoerd@acm.org>]]></a> not leave the CDATA intact and not replace the < to < ?
Disclaimer: I am not very sure what should be correct. http://www.w3.org/TR/2003/WD-xslt-xquery-serialization-20030502/ states Note: This is phrased to permit an implementor to provide an option that attempts to preserve CDATA sections present in the source document. CDATA is CDATA, no matter the representation. In both cases the content of the <a> element is CDATA, it's just encoded differently. I doubt
On 07/12/2007 08:46 PM, Arjen P. de Vries wrote: that there is a way for MonetDB/XQuery to find out which encoding was used.
2. Should xquery><![CDATA[<sjoerd@acm.org>]]></a> more>MAPI = monetdb@localhost:50000 QUERY = <![CDATA[<sjoerd@acm.org>]]></a> ERROR = !parse error: syntax error, unexpected
also have been allowed - a bit weird if it is allowed inside another element? I don't know enough about XQuery, but my guess is: no.
When you look at the XQuery grammar (http://www.w3.org/TR/xquery/#nt-bnf) you'll see that (after the optional prologue stuff) the query consists of a list of comma-separated ExprSingles, and that an ExprSingle is one of FLWORExpr, QuantifiedExpr, TypeswitchExpr, IfExpr, OrExpr. The only one (in a quick scan) that doesn't have to start with a keyword is OrExpr in the guise of a PathExpr. And the only CDataSection (<![CDATA[...]]>) is inside a <tag>...</tag> construct.
Cheers.
Arjen
On 12/07/07, Sjoerd Mullender
wrote: Arjen P. de Vries wrote:
While <a /> is accepted as a query, <![CDATA[<]]> is not. !parse error: syntax error, unexpected
Is that the expected behaviour?
Context: I try to output email addresses as "test
" and failing Arjen
This works:
xquery><a><![CDATA[<sjoerd@acm.org>]]></a> more><> <a><sjoerd@acm.org></a>
-- Sjoerd Mullender
-- Sjoerd Mullender
-- Jan Rittinger Database Systems Technische Universität München (Germany) http://www-db.in.tum.de/~rittinge/
participants (3)
-
Arjen P. de Vries
-
Jan Rittinger
-
Sjoerd Mullender