String system_id = null;
Object local = null;
try {
if (xinclude.href.equals("")) {
if (xinclude.xpath == null) {
throw new ProcessorException("Invalid xinclude element: "+xinclude+": no href, no valid suffix");
}
NodeList list = XPathAPI.selectNodeList(document,xinclude.xpath);
int length = list.getLength();
Node ary[] = new Node[length];
for (int i=0; i<length; i++) {
ary[i] = list.item(i).cloneNode(true);
}
return ary;
} else if (xinclude.href.charAt(0) == '/') {
/** local absolute URI, e.g. /foo.xml **/
local = new File(Utils.getRootpath(request,context),xinclude.href.substring(1));
system_id = ((File)local).getAbsolutePath();
content = new FileReader((File)local);
} else if (xinclude.href.indexOf("://") >= 0) {
/** absolute URI, e.g. http://example.com/foo.xml **/
local = new URL(xinclude.href);
system_id = local.toString();
content = ((URL)local).getContent();
} else if (xinclude.base instanceof URL) {
/** relative URI, relative to XML Base URI **/
local = new URL((URL)xinclude.base,xinclude.href);
system_id = local.toString();
content = ((URL)local).getContent();
} else if (xinclude.base instanceof File) {
/** relative URI, relative to XML file in filesystem **/
local = new File((File)xinclude.base,xinclude.href);
system_id = ((File)local).getAbsolutePath();
content = new FileReader((File)local);
}
processor.monitored_table.put(monitor_key,"");
processor.monitor.watch(monitor_key,local);
} catch (MalformedURLException e) {
throw new ProcessorException("Invalid xinclude element: "+xinclude+": malformed URL");
}
Object result = null;
if (xinclude.parse.equals("text")) {
if (content instanceof Reader) {
Reader reader = (Reader)content;