"Mark Weaver" <[EMAIL PROTECTED]> wrote on 04/09/2004 03:34:09 PM:
> > It looks like the specs don't take into consideration XML Schema; what
> > should "name" contain in that case?
> I have no idea!
The EntityResolver interface was designed for resolving external entities (both general and parameter) and external subsets as defined in XML 1.0. The name parameter corresponds to the name of one of these entities. Since SAX doesn't have a more general resource resolver, EntityResolver is used (or misused depending on how you look at it) in other contexts besides the ones it was defined for. The name and publicId parameters are not applicable to XML schemas. The target namespace of the schema which would be useful for resolving it, isn't reported. DOM Level 3's [1] LSResourceResolver is a little more multipurpose, providing the type of resource being resolved and a namespace (if one exists) for the resource.
> > If this resolver should be invoked only when a DTD entity is being
> > resolver, the informations is almost there; the LastExtEntityInfo
> > structure
> > needs to be extended with a "name" field, that getLastExtEntityInfo would
> > fill by using the XMLEntityDecl currently in scope.
> >
> Right, I can have a go at that.
>
>
> > >Then I'm also left with the getExternalSubset() function, which again, I
> > >don't know where or how to implement.
> >
> > It should probably be handled like the setExternalSchemaLocation is
> > handled; when isRoot is true and the setting has been set, the
> > resolver is
> > invoked and the DTD is parsed like it was specified in the prolog.
> >
> I'm not entirely clear about that, but I'll have another look around the
> code and see if it makes any more sense.
I've just implemented this in Xerces-J [2]. For documents which have no DOCTYPE declaration, the name of the root element needs to be scanned before invoking getExternalSubset on the EntityResolver. Values of attributes in the root element may contain references to entities which are defined in the external subset, so if the scanner expands entity references as they are encountered, the external subset needs to be read immediately after scanning the name of the root element.
> Thanks,
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
[1] http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html#LS-LSResourceResolver
[2] http://marc.theaimsgroup.com/?l=xerces-cvs&m=108146308918611&w=2
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]
- exposing setXMLEntityResolver to the SAX parser Mark Weaver
- Re: exposing setXMLEntityResolver to the SAX par... Alberto Massari
- RE: exposing setXMLEntityResolver to the SAX... Mark Weaver
- RE: exposing setXMLEntityResolver to the... Mark Weaver
- RE: exposing setXMLEntityResolver to the... Alberto Massari
- RE: exposing setXMLEntityResolver to... Mark Weaver
- RE: exposing setXMLEntityResolv... Michael Glavassevich
- RE: exposing setXMLEntityRe... Mark Weaver
- RE: exposing setXMLEntityResolver to... Mark Weaver
