I hope this list is an appropriate place to ask this question; I've
spent quite a bit of time grepping and reading the source, and I think
this is my best bet.

I'm trying to use the xerces-c library through the Sleepycat DB XML
software package. Whenever I call the putDocument method on an
XmlContainer, I consistently have an exception thrown from the
following line in the WFXMLScanner class:

    // check for duplicate namespace attributes:
    // by checking for qualified names with the same
    // local part and with prefixes
    // which have been bound to namespace names that are identical.
    XMLAttr* loopAttr;
    XMLAttr* curAtt;
    for (unsigned int attrIndex=0; attrIndex < attCount-1; attrIndex++) {
        loopAttr = fAttrList->elementAt(attrIndex);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        for (unsigned int curAttrIndex = attrIndex+1; curAttrIndex < 
attCount; curAttrIndex++) {
            curAtt = fAttrList->elementAt(curAttrIndex);
            if (curAtt->getURIId() == loopAttr->getURIId() &&
                XMLString::equals(curAtt->getName(), loopAttr->getName())) {
                emitError
                (
                    XMLErrs::AttrAlreadyUsedInSTag
                        , curAtt->getName()
                        , elemDecl->getFullName()
                );
            }
        }
    }

This is from the scanStartTagNS method in the WFXMLScanner.cpp
file. The method fAttrList->elementAt is throwing an
ArrayIndexOutofBoundsException. I realize this has to do with software
besides simply xerces, but just from looking over this method's code,
it doesn't look like it should ever throw an exception right here,
regardless of how badly deformed the XML file is. I've run a few
different test programs, and all of them have the same result: I
simply can't call the putDocument method without generating an
exception. Here is one small test program that reproduced the error
for me:

#include "dbxml/DbXml.hpp"
#include "db_cxx.h"
using namespace DbXml;

int main()
{
    XmlContainer container(NULL, "test.dbxml");
    container.open(NULL, DB_CREATE);

    XmlDocument document;
    document.setContent("<testing><a><b><c></c></b></a></testing>");

    try {
        container.putDocument(NULL, document);
    }
    catch (std::exception &e) {
        std::cerr << e.what() << std::endl;
    }

    return 0;
}

Here is the output:

$ ./add_doc
Error: XML Indexer: Fatal parse error in document '', line 1, char 10.
Parser Error Message: An exception occurred!
Type:ArrayIndexOutofBoundsException, Message:The passed index is past
the end of the vector

The char number given in the exception is consistently the index of
the '>' character in the first tag. Again, sorry if this question is
not on-topic on this list and thanks for any help.

Josh

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to