This content has been marked as final. Show 1 reply
I have more information about this problem. It appears to be caused by spaces in the filename or path of the container in forming the collection() prefix in my xQuery. For the following test, I was using a container named "EEF-PGL10GenAncestors Only.gcdb" in my Environment folder. Here is the code that fails.
XmlQueryContext context = xmlmanGCDB.createQueryContext();
String sContainerName = xmlcontGCDB.getName();
FileObject foContainer = FileUtil.toFileObject(new File(sContainerName));
sContainerName = foContainer.getNameExt();
sContainerName = Util.convertFilepathToURI(sContainerName);
String sQuery = "collection(\"" + sContainerName + "\")/" + GCDBTAG_INDI;
if(bDebug) DebugOut.println("sQuery: " + sQuery);
XmlQueryExpression xmlquery = xmlmanGCDB.prepare(sQuery, context);
XmlResults xmlresults = xmlquery.execute(context);
XmlDocument xmldoc = xmlmanGCDB.createDocument();
boolean bRet = xmlresults.next(xmldoc);
1. When I run it with the container named above with space and with the Util.convertFilepathToURI() call commented out, I get an XmlException executing the XmlManager.prepare() call. Based on this, I thought that you must be requiring percent encoding of spaces. The exception had Error Code 6: Invalid URI format [err:FODC0002], errcode = QUERY_PARSER_ERROR. The debug line displayed as
sQuery: collection("EEF-PGL10GenAncestors Only.gcdb")/INDI
2. So, if you uncomment that Util.convertFilepathToURI() call line and run it again, the debug line displays
but that also caused an XmlException with Error Code 17: EEF-PGL10GenAncestors%20Only.gcdb: container file not found, or not a container, errcode = CONTAINER_NOT_FOUND. So, it is not interpreting the space as a %20 correctly.
3. Finally, if I take the space out of the filename and rerun, the debug line displays
and everything works just fine. Are you using some other way to encode this space in a container name besides what I have tried? I need some help here folks.