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 SD <te...@damle.name> on 2006/12/05 22:25:33 UTC
EntityResolver problem while using SAX parser
Our XML file starts with :
<ourproj:rootXmlTag xmlns:ourproj="http://www.ourwebsite.com/ourproj">
The XML schema corresponding to http://www.ourwebsite.com/ourproj is to be generated by our code from database.
This is done by our own EntityResolver interface implementation.
When we try to parse above file using SAX parser, we get error :
Cannot find the declaration of element 'ourproj:rootXmlTag'
and our EntityResolver class implementation's 'resolveEntity' method is not called ...
Since we have multiple schemas and all are generated (not present at an URL), hence we cannot specify the xsi:schemaLocation attribute.
Has anyone encountered this problem before ?
--SD
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: EntityResolver problem while using SAX parser
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
SD <te...@damle.name> wrote on 12/05/2006 04:25:33 PM:
> Our XML file starts with :
>
> <ourproj:rootXmlTag xmlns:ourproj="http://www.ourwebsite.com/ourproj">
>
> The XML schema corresponding to http://www.ourwebsite.com/ourproj is
> to be generated by our code from database.
> This is done by our own EntityResolver interface implementation.
>
> When we try to parse above file using SAX parser, we get error :
> Cannot find the declaration of element 'ourproj:rootXmlTag'
> and our EntityResolver class implementation's 'resolveEntity' method
> is not called ...
>
> Since we have multiple schemas and all are generated (not present at
> an URL), hence we cannot specify the xsi:schemaLocation attribute.
>
> Has anyone encountered this problem before ?
SAX's EntityResolver was only designed for resolving external entities
(the external DTD subset, external parameter entities and external general
entities). If you want the target namespace for the schema you should use
an API which has a resolver that will pass that information (see the JAXP
1.3 Validation API [1] and LSResourceResolver [2]) to you. For more info
you should also take a look at:
http://issues.apache.org/jira/browse/XERCESJ-1158 where this issue was
discussed in more detail.
> --SD
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
[1]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/package-summary.html
[2]
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSResourceResolver.html
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org