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 bu...@apache.org on 2002/10/15 10:05:54 UTC

DO NOT REPLY [Bug 13639] New: - Failure to parse xsi:schemaLocation attribute value correctly

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13639>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13639

Failure to parse xsi:schemaLocation attribute value correctly

           Summary: Failure to parse xsi:schemaLocation attribute value
                    correctly
           Product: Xerces-C++
           Version: 2.1.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Validating Parser (Schema) (Xerces 1.5 or up only)
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: martin@formicula.fsnet.co.uk


Assume an XML document starts like this:

<?xml version="1.0" encoding="UTF-8" ?>
<wfs:FeatureCollection
 xmlns:wfs="http://www.my-namespace.com/wfs"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.my-namespace.com/wfs http://www.my-host.com/my-
isapi.dll?
request=DescribeFeatureType&amp;service=WFS&amp;version=1.0.0&amp;typename=MyTyp
e">

When the XML document is parsed with schema validation,
the parser tries but fails to load the XSD document
referenced in the xsi:schemaLocation attribute.

The problem lies in the '&amp;' entities in the URL.
The parser properly converts the '&amp;' entities into '&'
characters, but it inserts an 0xFFFF character immediately
before the '&' as a flag for some other purpose. But when
the URL is being opened the 0xFFFF character is still there
and the resource can't be found.

I could fix this bug in XMLScanner2.cpp:

void XMLScanner::normalizeURI(const XMLCh* const systemURI,
                              XMLBuffer& normalizedURI)
{
    const XMLCh* pszSrc = systemURI;

    normalizedURI.reset();

    while (*pszSrc) {
        if ((*(pszSrc) == chPercent)
        &&  (*(pszSrc+1) == chDigit_2)
        &&  (*(pszSrc+2) == chDigit_0))
        {
            pszSrc += 3;
            normalizedURI.append(chSpace);
        }
        else if (*pszSrc == 0xFFFF) { // added MS
            pszSrc++;                 // added MS
        }                             // added MS
        else {
            normalizedURI.append(*pszSrc);
            pszSrc++;
        }
    }
}

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