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=/
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion