Package org.apache.cocoon.processor

Examples of org.apache.cocoon.processor.ProcessorException


    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;
View Full Code Here


    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);
        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;
View Full Code Here

TOP

Related Classes of org.apache.cocoon.processor.ProcessorException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.