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 Michael Glavassevich <mr...@ca.ibm.com> on 2004/01/20 18:18:15 UTC

XInclude Implementation Problems

Hi everyone,

I was just looking at some of the changes which have gone into the 
XInclude implementation since the last release and I have some concerns 
about the support for content negotiation [1] (added in the latest working 
draft of XInclude).  Currently we're opening a URLConnection to set the 
Accept, Accept-Language, Accept-CharSet request properties and setting the 
input stream from this URLConnection on the input source in 
XIncludeHandler.  Since we're modifying the input source before the parser 
(or text reader in the case of text includes) has had a chance to see it 
this has the unfortunate side-effect of trampling code which needed to 
read the URLConnection. The parser currently needs the URLConnection to 
follow HTTP redirects. The text reader needs the URLConnection to 
determine the encoding of the text include. Because we process the URL too 
early this information is lost.  Another problem with opening a 
URLConnection this early is that we're doing it before consulting the 
user's entity resolver.  The include location specified in the instance 
document may not be the one we're actually loading, and if it's non-URL 
URI or some protocol Java doesn't support we're going to report a fatal 
error.  And if the user provides a new system id when the parser calls 
their entity resolver their content negotiation preferences won't be 
picked up.

Fixing the problem for text includes should be fairly straightforward.  I 
volunteer to do it.

For xml includes I think we should postpone providing support for content 
negotiation to a future release.  At the moment, I don't see how we can 
make it work cleanly since we spawn another parser to handle the includes.

[1] http://www.w3.org/TR/xinclude/#content-negotiation

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Re: XInclude Implementation Problems

Posted by Elliotte Rusty Harold <el...@metalab.unc.edu>.
Interesting. Please forward this report of your experience as an 
implementer to the XInclude working group at 
www-xml-xinclude-comments@w3.org
This is exactly the sort of detailed information they need at this stage.

Also, note that support for Accept headers is optional in 
implementations, so it's not nonconformant to leave it out.
-- 

   Elliotte Rusty Harold
   elharo@metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml            
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA 

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