Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.0
-
Fix Version/s: 2.0
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
The behavior of the document() function is currently navigator-dependent and hard-wired. This should be pluggable to allow people to, e.g., retrieve documents from the web, from JNDI, from a database, from a JAR, etc.
Personally, I came across this issue when I wanted to bundle up Jaxen together with a set of unit tests to validate integrity of the packages but couldn't get the document() function to look in the JAR instead of the filesystem.
Here is the first email I sent to the list on the subject:
Right now, the getDocument() function looks like:
public Object getDocument(String uri) throws FunctionCallException
{ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse( uri ); }{
try
catch (Exception e)
{ throw new FunctionCallException("Failed to parse doucment for URI: " + uri, e); }}
I would like to suggest the following enhancements:
1) Cache the DocumentBuilderFactory and/or DocumentBuilder once created. (What is the status of a Navigator with respect to threads?)
2) Supply a method to register an EntityResolver instance with the Navigator so that custom resolution is possible.
I'll implement them and submit some code if there is agreement on what to do across the different navigators.
Thanks in advance.