Thanks, that solved the crashing problem, but I note that even though 
the query runs, the xml document is still in the database collection. 
I've added some debug code and it shows me the literal value of the string:

for $x in //aRecord where $x/id = "TESTNAME" return $x

and yet when I run it, I still see this document in the database 
(07056ec9.xml):

<?xml version="1.0" standalone="yes"?>
<booking>
 <id>TESTNAME</id>
 <name>Joe Mudd</name>
 <source>SYD</source>
</booking>

If the string matches, why didn't the file get zapped?


Ivan Shcheklein wrote:
> Hi Dean,
>
> Possibly you should try to add "":
>
> String query = "for $x in //aRecord \n"+
> "where $x/id = *\"*" + username +"*\"*\nreturn $x";
>
> Ivan Shcheklein,
> Sedna Team
>
> On Mon, Sep 22, 2008 at 12:16 PM, Dean Malandris 
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
>
>     I'm trying to remove an xml document from a collection, but when it
>     runs, I get the following error message:
>
>     XMLDB Error: 1:SEDNA Message: ERROR XPDY0002 It is a dynamic error if
>     evaluation of an expression relies on some part of the dynamic context
>     that has not been assigned a value.
>
>
>     This is the structure of the documents in the collection:
>
>     <?xml version="1.0" standalone="yes"?>
>     <booking>
>      <id>FRED125</id>
>      <name>Fred Bloggs</name>
>      <source>MEL</source>
>     </booking>
>
>     What I want to do is search for documents with "FRED125" in the id
>     element (passed in as "username" in the query), and nuke them:
>
>                             // Delete from database
>                            try
>                                {
>                                    registerXMLDBDriver();
>                                    Collection bookings =
>     DatabaseManager.getCollection(databaseURI, databaseUsername,
>     databasePassword);
>
>                                    String query = "for $x in //aRecord
>     \n"+
>     "where $x/id = " + username +"\nreturn $x";
>                                    XQueryService service =
>     (XQueryService)bookings.getService("XQueryService", "1.0");
>                                    ResourceSet resultSet =
>     service.query(query);
>                                    ResourceIterator results =
>     resultSet.getIterator();
>                                    while (results.hasMoreResources())
>                                    {
>                                        XMLResource resource =
>     (XMLResource)
>     results.nextResource();
>                                        bookings.removeResource(resource);
>                                    }
>
>                                    // Close up shop.
>                                    bookings.close();
>                                 }
>
>
>     I know I've probably done something silly with the syntax of the query
>     string itself. Advice please?
>
>     -------------------------------------------------------------------------
>     This SF.Net email is sponsored by the Moblin Your Move Developer's
>     challenge
>     Build the coolest Linux based applications with Moblin SDK & win
>     great prizes
>     Grand prize is a trip for two to an Open Source event anywhere in
>     the world
>     http://moblin-contest.org/redirect.php?banner_id=100&url=/
>     <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>     _______________________________________________
>     Sedna-discussion mailing list
>     [email protected]
>     <mailto:[email protected]>
>     https://lists.sourceforge.net/lists/listinfo/sedna-discussion
>
>


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion

Reply via email to