Re: setEntityResolver

"Neil Graham" <[email protected]> Sat, 9 Aug 2003 21:27:30 -0400
Newsgroups gmane.text.xml.sax.devel
Message-ID <[email protected]>
Hi Elliotte,

If you look at the javadocs for the EntityResolver interface [1], you'll
read that

"If the system identifier is a URL, the SAX parser must resolve it fully
before reporting it to the application."

This implies that there is no way for the application to see either the
original relative URL appearing in the document, or have direct access to
the base SystemId that the parser felt like using to absolutize this URL.
The proposed EntityResolver2 interface goes some way to remedy this, by
giving the application access to the base system identifier, and by
redefining the meaning of the systemId parameter to be the text that
appears in the document.  Unfortunately, this time the application always
has to do the work of combining the two into an absolutized system
ID--something every current parser must know how to do because of
EntityResolver.

IMHO, all three pieces of information should be provided in the ideal
entity resolver interface.  I'm also more than a bit disturbed by the
"name" parameter on EntityResolver2#resolveEntity(...), since resolving XML
entities is only one of the things entity resolvers are used for nowadays;
resolving schemaLocations in both instance documents and schema documents
is another large and seemingly growing class of applications, and it's not
at all obvious this use will be well-served by the new interface.

Cheers,
Neil

[1]:  http://www.saxproject.org/apidoc/org/xml/sax/EntityResolver.html

Neil Graham
XML Parser Development
IBM Toronto Lab
Phone:  905-413-3519, T/L 969-3519
E-mail:  [email protected]




|---------+------------------------------------->
|         |           Elliotte Rusty Harold     |
|         |           <[email protected]>  |
|         |           Sent by:                  |
|         |           [email protected]|
|         |           ceforge.net               |
|         |                                     |
|         |                                     |
|         |           08/09/2003 07:12 AM       |
|         |                                     |
|---------+------------------------------------->
  >---------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                             |
  |       To:       Denero Watz <[email protected]>, [email protected]                                                        |
  |       cc:                                                                                                                                   |
  |       Subject:  Re: [Sax-devel] setEntityResolver                                                                                           |
  |                                                                                                                                             |
  |                                                                                                                                             |
  >---------------------------------------------------------------------------------------------------------------------------------------------|



    I just started working on a maintenance project and very new to
this. The scenario in my code is to parse a WSDL document. I have
seen the person who developed the code had implemented this
setEntityResolver() method by implementing the EntityResolver
interface.
I want to know what this method is supposed to do. From the docs what
I understood was that this method should resolve all the relative
urls in the <!DOCTYPE> definition of the xml document to an absolute
url. Can someone clarify this.


See
http://www.cafeconleche.org/books/xmljava/chapters/ch07s02.html#d0e10350
--

   Elliotte Rusty Harold
   [email protected]
   Processing XML with Java (Addison-Wesley, 2002)
   http://www.cafeconleche.org/books/xmljava
   http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
List: sax-devel, [email protected]
See:  http://www.saxproject.org/
https://lists.sourceforge.net/lists/listinfo/sax-devel





-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
List: sax-devel, [email protected]
See:  http://www.saxproject.org/
https://lists.sourceforge.net/lists/listinfo/sax-devel