473,379 Members | 1,544 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

xquery error

Hi,
I'm trying to execute a xquery statement and I get always errors.
It seems that only the prolog section is giving me errors.
If I want to declare a namespace the xquery processor is coming up with
an "unexpected token" error.
The same error appears if I just set the version.
The xquery statement itself is working without prolog, but I get no
results because of the missing namespace.
db2 => xquery declare default element namespace "http://posample.org";

SQL16002N An XQuery expression has an unexpected token "" following
"http://posample.org"". Expected tokens may include: "<MainModule>".
Error
QName=err:XPST0003. SQLSTATE=10505

May 31 '06 #1
2 4294
Hi,

A question almost identical to this was recently answered on the
developerworks Viper Forum.

http://www-128.ibm.com/developerwork...=118807&cat=19

Basically, a prolog itself is not enough, you need to follow it with
some xquery. The simplest query I used was the expression 3. So I
tried:

db2 -td%
xquery declare default element namespace "http://posample.org"; 3%
and this worked.

Note that since the ; is used to separate the prolog from the xquery
body, I changed the terminator to %.

I hope this helps, post if you still have trouble.

TomE

ta***********@gmail.com wrote:
Hi,
I'm trying to execute a xquery statement and I get always errors.
It seems that only the prolog section is giving me errors.
If I want to declare a namespace the xquery processor is coming up with
an "unexpected token" error.
The same error appears if I just set the version.
The xquery statement itself is working without prolog, but I get no
results because of the missing namespace.
db2 => xquery declare default element namespace "http://posample.org";

SQL16002N An XQuery expression has an unexpected token "" following
"http://posample.org"". Expected tokens may include: "<MainModule>".
Error
QName=err:XPST0003. SQLSTATE=10505


Jun 6 '06 #2
I should have been more clear:

I wrote:
Basically, a prolog itself is not enough, you need to follow it with
some xquery.
I should have said: you need to follow it with your desired xquery.
Combine the xquery you want to execute and the prolog, and alter the
terminator to have DB2 eat them in one gulp.

The prolog will apply only to the xquery that follows it in the same
DB2 statement.

TomE

tome wrote: Hi,

A question almost identical to this was recently answered on the
developerworks Viper Forum.

http://www-128.ibm.com/developerwork...=118807&cat=19

Basically, a prolog itself is not enough, you need to follow it with
some xquery. The simplest query I used was the expression 3. So I
tried:

db2 -td%
xquery declare default element namespace "http://posample.org"; 3%
and this worked.

Note that since the ; is used to separate the prolog from the xquery
body, I changed the terminator to %.

I hope this helps, post if you still have trouble.

TomE

ta***********@gmail.com wrote:
Hi,
I'm trying to execute a xquery statement and I get always errors.
It seems that only the prolog section is giving me errors.
If I want to declare a namespace the xquery processor is coming up with
an "unexpected token" error.
The same error appears if I just set the version.
The xquery statement itself is working without prolog, but I get no
results because of the missing namespace.
db2 => xquery declare default element namespace "http://posample.org";

SQL16002N An XQuery expression has an unexpected token "" following
"http://posample.org"". Expected tokens may include: "<MainModule>".
Error
QName=err:XPST0003. SQLSTATE=10505


Jun 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tom Corcoran | last post by:
I am working to ease updating of a html page by transforming 2 xml files. I was going to use xslt for this and had bought 2 unopened books, wrox xslt and o'reilly's xslt cookbook. But am now...
0
by: Benjamin G. Jones | last post by:
I am having a very basic problem with XQuery. I want to use an XQuery API in Java (either Saxon or Qexo), and I have an XQuery expression that works as expeced from the command line if I specify...
0
by: Tony Lavinio | last post by:
Dear Stylus Studio Friends, The new year is scarcely one month old, but we already have lots to report! For starters, there's Stylus Studio 6 Release 2. The latest release of Stylus Studio...
0
by: pepin_labulle | last post by:
I'm a newbie with XQuery and I'm trying to execute a query with Saxon. If I don't specify the XML source file name in the query, Saxon raises the following error :...
0
by: Stylus Studio | last post by:
DataDirect XQuery(TM) is the First Embeddable Component for XQuery That is Modeled after the XQuery API for Java(TM) (XQJ) BEDFORD, Mass.--Sept. 20, 2005--DataDirect Technologies...
8
by: Clamps | last post by:
So I've been reading about XQuery, but cannot find a dll or namespace download to use the technology in vs.net 2002 or 2003. Any directions would be great. -- "If I'm the president, we're going...
2
by: Ale | last post by:
Hi all! I need to build a middleware for XQuery: I mean a software receiving a std xquery and outputting the xquery result on "database.xml". This middleware must use 7 or 8 different choosable...
3
by: Bloody Viking | last post by:
Namaste, Y'all! I've got a valid XQuery expression that I need to convert to XPath 2.0. This expression will be stored in a resource file and applied to XML by a Java program with saxon8.jar...
1
by: sevak316 | last post by:
ok, im going nuts, why am i getting an error here? PLEASE HELP xquery version "1.0"; let $count := 0 for $dept in doc("store.xml")/root/dept return <total_items> {
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.