Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-674

Failure to parse xsi:schemaLocation attribute value correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.1.0
    • 2.2.0
    • None
    • Operating System: Windows NT/2K
      Platform: PC
    • 13639

    Description

      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&service=WFS&version=1.0.0&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 '&' entities in the URL.
      The parser properly converts the '&' 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++; }

      }
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            martin@formicula.fsnet.co.uk Martin Schaefer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: