You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Slava Pestov <sl...@jedit.org> on 2003/02/15 22:18:23 UTC

XSD entity resolver weirdness

Hi,

When exactly does the XSD loader use the parser's entity resolver and when 
does it not?

My XML editor downloads and caches schemas to minimize network activity. The 
problem I am having is with schemas that include other schemas using 
<xs:include>, for example:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" version="1.0">
  <xs:include schemaLocation="dbnotn.xsd"/>
  <xs:include schemaLocation="dbcent.xsd"/>
  <xs:include schemaLocation="dbpool.xsd"/>
  <xs:include schemaLocation="dbhier.xsd"/>
</xs:schema>

The first time a file referencing an http: schema is opened, my custom entity 
resolver  downloads and saves the schema to a local file named, say 
/home/slava/.jedit/dtds/cache39516.xml. Then each of of the <xs:include>'ed 
files is passed to the entity resolver, and correspondingly downloaded and 
cached. So far, so good.

The second time a file referencing this schema is opened, the top-level file 
is resolved correctly from the cache. Unfortunately, Xerces then attempts to 
look for files named "dbnotn.xsd", "dbcent.xsd", "dbpool.xsd" and 
"dbhier.xsd" in the current directory, instead of passing these path names to 
the entity resolver. This is wrong. Why does it behave differently in this 
case, just because the top-level file is a local file? Why doesn't it 
_always_ pass all path names to the entity resolver?
-- 
Slava Pestov

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


Re: XSD entity resolver weirdness

Posted by Slava Pestov <sl...@jedit.org>.
Never mind, upgrading to Xerces 2.3 fixed the problem.

On February 15, 2003 04:18 pm, Slava Pestov wrote:
> Hi,
>
> When exactly does the XSD loader use the parser's entity resolver and when
> does it not?
>
> My XML editor downloads and caches schemas to minimize network activity.
> The problem I am having is with schemas that include other schemas using
> <xs:include>, for example:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" version="1.0">
>   <xs:include schemaLocation="dbnotn.xsd"/>
>   <xs:include schemaLocation="dbcent.xsd"/>
>   <xs:include schemaLocation="dbpool.xsd"/>
>   <xs:include schemaLocation="dbhier.xsd"/>
> </xs:schema>
>
> The first time a file referencing an http: schema is opened, my custom
> entity resolver  downloads and saves the schema to a local file named, say
> /home/slava/.jedit/dtds/cache39516.xml. Then each of of the <xs:include>'ed
> files is passed to the entity resolver, and correspondingly downloaded and
> cached. So far, so good.
>
> The second time a file referencing this schema is opened, the top-level
> file is resolved correctly from the cache. Unfortunately, Xerces then
> attempts to look for files named "dbnotn.xsd", "dbcent.xsd", "dbpool.xsd"
> and
> "dbhier.xsd" in the current directory, instead of passing these path names
> to the entity resolver. This is wrong. Why does it behave differently in
> this case, just because the top-level file is a local file? Why doesn't it
> _always_ pass all path names to the entity resolver?

-- 
Slava Pestov

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