[ 
https://issues.apache.org/jira/browse/XERCESC-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12556204#action_12556204
 ] 

Brenton Thomas commented on XERCESC-1773:
-----------------------------------------

The big picture is I want to keep local copies of XMLSchema.xsd and XML.xsd 
inside my executable directory. I can not make the assumption with this code 
there will be any network access at all allowed from where it will be used and 
"the real world" .  

So the solution seems to be to use XMLUni::fgXercesSchemaExternalSchemaLocation 
to override the suggestion of where to find the base schema's and redirect them 
to the local versions.

I have gotten to the point that when the namespaces are being loaded using the 
suggestions in the XML doc all is fine - well at least up to the point that 
validation fails because I haven't implemented mandatory elements - but that is 
is goodness it means validation is working.

but when I try XMLUni::fgXercesSchemaExternalSchemaLocation on blank escaped 
strings I end up with

0x000000000012ccc0 "Schema in 
d:\Home\Development\StrawberryFields%202.0\StrawberryFields\Common\bin\WIN64\Debug\XML1998.xsd
 has a different target namespace from the one specified in the instance 
document

(XML1998.xsd is just xml.xsd with a different filename)


but if I escape both the string and the number I get

0x000000000012a130 "An exception occurred! Type:RuntimeException, 
Message:Warning: The primary document entity could not be opened. 
Id=d:\Home\Development\StrawberryFields 
%32.0\StrawberryFields\Common\bin\WI......

> Spaces in Filenames problem with XMLUri::normalizeURI
> -----------------------------------------------------
>
>                 Key: XERCESC-1773
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1773
>             Project: Xerces-C++
>          Issue Type: Bug
>         Environment: WindowsXP 64
>            Reporter: Brenton Thomas
>             Fix For: 2.8.0
>
>
> When using a filename containing spaces that has been escaped by a %20 you 
> end up with problems if the space is followed by a number. For example if you 
> have a directory  "D:\Home\Development\StrawberryFields 2.0" you need to 
> escape it to give "D:\Home\Development\StrawberryFields%202.0"  - which is 
> obviously going to break because it confuses the 2 at the end.  To fix this 
> you escape the number following the space to give 
> "D:\Home\Development\StrawberryFields%20%32.0" .  
> This is OK in terms of providing a legal schemaLocation except....
> The routine XMLUri::normalizeURI  then takes the escaped name and unescapes 
> it to return a form the system recognises.  What it needs to do is parse 
> through the string and unescape everything - not just the %20 
> void XMLUri::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 
>         {
>             normalizedURI.append(*pszSrc);
>             pszSrc++;
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to