Dave,
thanks for the valuable observation and the hints what could be the reason. I didn't manage to reproduce the problem, though. This is what I tried:
basex -c "create db db <a/>;xquery insert node <b/> before /a;optimize"
Do you have a little example that leads to the discussed problem? Next, I'll also be glad to look at one of the documents with text before the root node that is erroneously accepted by our parser.
Thanks! Christian ___________________________
On Tue, Dec 20, 2011 at 6:32 PM, Dave Glick dglick@dracorp.com wrote:
Hello,
I seem to have stumbled on a bug (or at least I think I have). Do the following:
- Create a simple database with a single document
- Insert a text node before the start of the document root ("insert node "test" before /root")
- Attempt to optimize the database
You will get a NullPointerException at org.basex.index.Names.index(Names.java:84). It appears as though the index is attempting to set statistics information for key id 0 (because the parent is a document), but the stats[] array only gets initialized with objects from index 1 and up.
The other possibility is that text nodes should not be allowed before or after the document root element. I'm a little hazy on what the standards say in this regard. My understanding is that the document node can have prolog content before the root and other content after. I've also seen many documents which parse correctly that have text content before the opening tag (though again, this may not be strictly standard-compliant behavior). If this is the case, then the bug is probably that the insertion update operation is allowed to succeed.
Dave
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk