[ 
http://issues.apache.org/jira/browse/XERCESJ-1158?page=comments#action_12375667 
] 

Michael Glavassevich commented on XERCESJ-1158:
-----------------------------------------------

A target namespace is not a schema location, nor is it a public identifier.  
SAX's entity resolver was only designed for resolving external entities (the 
external DTD subset, external parameter entities, external general entities). 
Andrew Jacobs acknowledges that in the document you've attached. Several people 
have argued that Xerces' treatment of schema locations as system identifiers is 
wrong.  I agree with them in principle but there really was no other option for 
SAX and its now legacy behaviour anyways.  Passing a schema's target namespace 
in place of the public identifier to an EntityResolver would be even more 
egregious.  It would be difficult to justify such a change, particularly since 
there are better options in JAXP 1.3.

I think Andrew must have written this document before JAXP 1.3 existed (or 
isn't aware of it).  JAXP 1.3 introduced a validation API 
(javax.xml.validation) [1][2] which decouples validation from parsing. The 
schema processing facilities in the .NET framework described by Andrew sound 
very similar to this API.  Both the SchemaFactory [3] and the Validator [4] use 
DOM Level 3's LSResourceResolver [5] for resolving schemas. LSResourceResolver 
was designed for schema resolution. One of the parameters passed to 
LSResolverResolver.resolveResource() is a namespace URI which will be the 
target namespace of the XML schema when the type parameter is equal to 
"http://www.w3.org/2001/XMLSchema";.  This resolver will be called even when no 
schema location hint is provided.

[1] http://www-128.ibm.com/developerworks/xml/library/x-jaxp13a.html#N101AE
[2] 
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/package-summary.html
[3] 
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/SchemaFactory.html
[4] 
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/Validator.html
[5] 
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSResourceResolver.html

> Entity resolver is not applied to namespace URI when used as possible Schema 
> location
> -------------------------------------------------------------------------------------
>
>          Key: XERCESJ-1158
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1158
>      Project: Xerces2-J
>         Type: Bug

>     Versions: 2.8.0
>     Reporter: Anthony B. Coates
>  Attachments: Correctly Resolving Schema Namespace URLs.doc
>
> When Xerces-J uses the namespace URI as a possible Schema location, it 
> bypasses the entity resolver.  This means that there is no way to resolve the 
> Schema to a local copy when there is no explicit "schemaLocation".  This is a 
> major problem in enterprise scenarios where the schemaLocation in incoming 
> XML messages may not be trustworthy, and only the namespace URI can be used 
> to resolve the correct Schema for processing.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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

Reply via email to