You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Rathi, Pradeep" <pr...@documentum.com> on 2001/03/05 20:59:06 UTC

RE: Likely bug when resolving relative paths for SYSTEM identifie rs

Hi Neil,

Appreciate you comments and I totally agree that the systemId should be a
URI. However, the parser is not consistent in enforcing it. E.g. If I've a
xml file in "C:\Test\" and have the corresponding DTD in "C:\" then the
parser succeeds with the following DOCTYPE declaration:

<!DOCTYPE foo SYSTEM "..\bar.dtd"> 

Further, if the DTD is not present at the expected location, in this
scenario it's "C:\", the parser throws a SAXParseException stating that the
file is not found. It's only if the you have too many of "..\" or "../", the
parser chokes. So as a user, I would expect the parser rather than to hang,
do one of the following:

1. Preferably, to enforce the condition that at all times the systemId is a
URI.
2. If it's resolving relative path's that are not URI's then should throw a
file not found error message under the above circumstances.

BTW, thanks for the backslashes tip :-)

Thanks,
Pradeep


> -----Original Message-----
> From: neilg@ca.ibm.com [mailto:neilg@ca.ibm.com]
> Sent: Monday, March 05, 2001 11:07 AM
> To: xerces-j-user@xml.apache.org
> Subject: Re: Likely bug when resolving relative paths for SYSTEM
> identifiers
> 
> 
> 
> 
> Hi Pradeep,
> 
> The problem is that Xerces is expecting a URI, not a path 
> (and especially
> not a Windows path) as a systemId.  i.e., the first thing not 
> to do in a
> systemId is to use backslashes.  :-)
> 
> Hope that helps,
> Neil
> 
> Neil Graham
> XML Parser Development
> IBM Toronto Lab
> Phone:  416-448-3519, T/L 778-3519
> E-mail:  neilg@ca.ibm.com
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 

RE: Likely bug when resolving relative paths for SYSTEM identifiers

Posted by Brad O'Hearne <ca...@megapathdsl.net>.
RE: Likely bug when resolving relative paths for SYSTEM identifiersPradeep,

Use:

<!DOCTYPE foo SYSTEM "bar.dtd">

and then use an EntityResolver to return the fully qualified uri.  I had
exactly the same issue.  This is what was recommended to me, and it works
great.

BradO
  -----Original Message-----
  From: Rathi, Pradeep [mailto:pradeep.rathi@documentum.com]
  Sent: Monday, March 05, 2001 11:59 AM
  To: 'xerces-j-user@xml.apache.org'
  Cc: Shah, Jignesh; Chu, Sharon
  Subject: RE: Likely bug when resolving relative paths for SYSTEM
identifiers


  Hi Neil,

  Appreciate you comments and I totally agree that the systemId should be a
URI. However, the parser is not consistent in enforcing it. E.g. If I've a
xml file in "C:\Test\" and have the corresponding DTD in "C:\" then the
parser succeeds with the following DOCTYPE declaration:

  <!DOCTYPE foo SYSTEM "..\bar.dtd">

  Further, if the DTD is not present at the expected location, in this
scenario it's "C:\", the parser throws a SAXParseException stating that the
file is not found. It's only if the you have too many of "..\" or "../", the
parser chokes. So as a user, I would expect the parser rather than to hang,
do one of the following:

  1. Preferably, to enforce the condition that at all times the systemId is
a URI.
  2. If it's resolving relative path's that are not URI's then should throw
a file not found error message under the above circumstances.

  BTW, thanks for the backslashes tip :-)

  Thanks,
  Pradeep



  > -----Original Message-----
  > From: neilg@ca.ibm.com [mailto:neilg@ca.ibm.com]
  > Sent: Monday, March 05, 2001 11:07 AM
  > To: xerces-j-user@xml.apache.org
  > Subject: Re: Likely bug when resolving relative paths for SYSTEM
  > identifiers
  >
  >
  >
  >
  > Hi Pradeep,
  >
  > The problem is that Xerces is expecting a URI, not a path
  > (and especially
  > not a Windows path) as a systemId.  i.e., the first thing not
  > to do in a
  > systemId is to use backslashes.  :-)
  >
  > Hope that helps,
  > Neil
  >
  > Neil Graham
  > XML Parser Development
  > IBM Toronto Lab
  > Phone:  416-448-3519, T/L 778-3519
  > E-mail:  neilg@ca.ibm.com
  >
  >
  >
  > ---------------------------------------------------------------------
  > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
  > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
  >