You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Scott Cantor <ca...@osu.edu> on 2010/02/15 05:24:22 UTC

Possible conflict in 3.1 between importNode and setPrefix

I believe there's a fix/change to the importNode method in 3.1 that's
supposed to maintain namespace prefixes across the import, but I think it's
conflicting with a check inside the DOMAttr::setPrefix method:

void DOMAttrNSImpl::setPrefix(const XMLCh *prefix)
{
    const XMLCh * xmlns = DOMNodeImpl::getXmlnsString();

    if (fNode.isReadOnly())
        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0,
GetDOMNodeMemoryManager);
    if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull ||
XMLString::equals(fLocalName, xmlns))
        throw DOMException(DOMException::NAMESPACE_ERR, 0,
GetDOMNodeMemoryManager);

My imports appear to be throwing the second exception listed because the
attribute node being manipulated is a default namespace prefix decl
(xmlns="..."). The XMLString::equals(fLocalName, xmlns) test is failing.

I haven't investigated further yet, but since this is all code internal to
Xerces, it seems like it's probably a bug. I think the problem is that the
code in importNode that's setting the prefix isn't checking if the prefix is
empty, and the check inside setPrefix really shouldn't fire unless the
prefix passed in is non-empty.

-- Scott



---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org