XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
ambika sonySubject: Saxon XQuery error
Author: ambika sony
Date: 01 Sep 2006 04:32 AM
hi guys
I'm using Saxon8 for doing xquery in my java application.
everything is working fine except for one case where i'm getting a very strange error which is :
XPST0003: XQuery syntax error in #...rsion='1.0' encoding='UTF-8'?>#:
A processing instruction must not be named 'xml' in any combination of upper and lower case

My XML is perfectly fine.
In my program i'm using XML as string to do the XQuery. so the query is very simple and in java it looks like

"for $x in" +fileString +"//bookTile"
"where $x/attribute()[contains(.,' java')]"
"return $x"

where fileString is string that contains the XML
It gives the above error but if instead of fileString if i store this XML in file it works fine with the same xml


I run query separtely in somewhere else like in ALTOVA XML spy then there is no problem but if i'm using it in java application Saxon is giving me this error.

If anyone have some clue about this then please tell me. I'm struck at this point
It will be a great help

Postnext
Ivan PedruzziSubject: Saxon XQuery error
Author: Ivan Pedruzzi
Date: 01 Sep 2006 09:27 AM
Ambika,
Literal XML PI are not allow in XQuery.

(: valid XQuery :)
<root/>

(: invalid XQuery :)
<?xml version="1.0"?>
<root/>

Ivan Pedruzzi
Stylus Studio Team
http://www.stylusstudio.com/xml_download.html

Postnext
ambika sonySubject: Saxon XQuery error
Author: ambika sony
Date: 01 Sep 2006 11:38 AM
Sorry but what does it exactly means
I think the query is right. ISn't

Posttop
Ivan PedruzziSubject: Saxon XQuery error
Author: Ivan Pedruzzi
Date: 01 Sep 2006 12:42 PM
The query is wrong, here is why

**************
Case 1

Asuuming variable "fileString" is equal to
"<book><bookTile id=' java'/></book>"

"for $x in" +fileString +"//bookTile" +
"where $x/attribute()[contains(.,' java')]" +
"return $x"

the query string becames

for $x in <book><bookTile id=' java'/></book>//bookTile
where $x/attribute()[contains(.,' java')]
return $x

The query works, the result is
<bookTile id=" java"/>

**********************************
Case 2

If variable "fileString" is equal to
"<?xml version="1.0"?><book><bookTile id=' java'/></book>"

the query string becames

for $x in <?xml version="1.0"?><book><bookTile id=' java'/></book>//bookTile
where $x/attribute()[contains(.,' java')]
return $x

Now the query is invalid because you can't have XML PI (<?xml version="1.0"?>) in the query body

******************************
Case 3

If variable "fileString" is equal to
"doc('myxmlfile.xml')"

the myxmlfile.xml contains
<?xml version="1.0"?>
<book><bookTile id=' java'/></book>

the query string became

for $x in doc('myxmlfile.xml')//bookTile
where $x/attribute()[contains(.,' java')]
return $x

The query works, the result is
<bookTile id=" java"/>


Ivan Pedruzzi
Stylus Studio Team

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.