tng 2002/12/06 09:05:30 Modified: c/src/xercesc/util XMLURL.cpp Log: For file protocol, need to manually replace any character reference %xx first Revision Changes Path 1.4 +41 -4 xml-xerces/c/src/xercesc/util/XMLURL.cpp Index: XMLURL.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLURL.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- XMLURL.cpp 4 Nov 2002 15:22:05 -0000 1.3 +++ XMLURL.cpp 6 Dec 2002 17:05:29 -0000 1.4 @@ -519,7 +519,9 @@ // style fully qualified path, we have to toss the leading / // character. // - const XMLCh* realPath = fPath; + XMLCh* realPath = XMLString::replicate(fPath); + ArrayJanitor<XMLCh> basePathName(realPath); + if (*fPath == chForwardSlash) { if (XMLString::stringLen(fPath) > 3) @@ -544,6 +546,42 @@ } } + // + // Need to manually replace any character reference %xx first + // HTTP protocol will be done automatically by the netaccessor + // + int end = XMLString::stringLen(realPath); + int percentIndex = XMLString::indexOf(realPath, chPercent, 0); + + while (percentIndex != -1) { + + if (percentIndex+2 >= end || + !isHexDigit(realPath[percentIndex+1]) || + !isHexDigit(realPath[percentIndex+2])) + { + XMLCh value1[4]; + XMLString::moveChars(value1, &(realPath[percentIndex]), 3); + value1[3] = chNull; + ThrowXML2(MalformedURLException + , XMLExcepts::XMLNUM_URI_Component_Invalid_EscapeSequence + , realPath + , value1); + } + + unsigned int value = (xlatHexDigit(realPath[percentIndex+1]) * 16) + xlatHexDigit(realPath[percentIndex+2]); + + realPath[percentIndex] = XMLCh(value); + + int i =0; + for (i = percentIndex + 1; i < end - 2 ; i++) + realPath[i] = realPath[i+2]; + realPath[i] = chNull; + end = i; + + percentIndex = XMLString::indexOf(realPath, chPercent, percentIndex); + } + + BinFileInputStream* retStrm = new BinFileInputStream(realPath); if (!retStrm->getIsOpen()) { @@ -955,11 +993,10 @@ // we didn't get them, so throw an exception // if (fProtocol == HTTP) { - ThrowXML1 + ThrowXML ( MalformedURLException , XMLExcepts::URL_ExpectingTwoSlashes - , "Found 'http' protocol" ); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]