You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Colin Paul Adams <co...@colina.demon.co.uk> on 2004/07/19 20:41:03 UTC

How do I find out why DOM parser fails

In the CForms xml binding script, there is code similar to:

function loadDocument(uri) {
    var parser = null;
    var source = null;
    var resolver = null;
    try {
        parser = cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE);
        resolver = cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE);
        source = resolver.resolveURI(uri);
        var is = new Packages.org.xml.sax.InputSource(source.getInputStream());
        is.setSystemId(source.getURI());
        var document = parser.parseDocument(is);
	cocoon.log.debug (document);
	return document;     
    } 
    finally {
        if (source != null)
            resolver.release(source);
        cocoon.releaseComponent(parser);
        cocoon.releaseComponent(resolver);
    }
}

but I am getting a value of null for the document variable.
How do I find out why the parser is failing to parse the document
content (which should be perctly valid xml)?
-- 
Colin Paul Adams
Preston Lancashire

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How do I find out why DOM parser fails

Posted by Olivier Billard <ob...@jouve.fr>.
No trace on the logs ?

Colin Paul Adams wrote:
>>>>>>"Olivier" == Olivier Billard <ob...@jouve.fr> writes:
> 
> 
>     Olivier> Hi Colin, You can catch thrown exceptions and log it.  A
>     Olivier> simple
> 
>     Olivier> try { ...  } catch (exception) { print("Error :" +
>     Olivier> exception.message); } finally { ...  }
> 
> But no exception is being thrown.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How do I find out why DOM parser fails

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "Olivier" == Olivier Billard <ob...@jouve.fr> writes:

    Olivier> Hi Colin, You can catch thrown exceptions and log it.  A
    Olivier> simple

    Olivier> try { ...  } catch (exception) { print("Error :" +
    Olivier> exception.message); } finally { ...  }

But no exception is being thrown.
-- 
Colin Paul Adams
Preston Lancashire

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How do I find out why DOM parser fails

Posted by Olivier Billard <ob...@jouve.fr>.
Hi Colin,

You can catch thrown exceptions and log it.
A simple

try {
     ...
} catch (exception) {
     print("Error :" + exception.message);
} finally {
     ...
}

should help you for development if you're using the embedded jetty (look 
at the jetty output)

--
Olivier Billard


Colin Paul Adams wrote:
> In the CForms xml binding script, there is code similar to:
> 
> function loadDocument(uri) {
>     var parser = null;
>     var source = null;
>     var resolver = null;
>     try {
>         parser = cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE);
>         resolver = cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE);
>         source = resolver.resolveURI(uri);
>         var is = new Packages.org.xml.sax.InputSource(source.getInputStream());
>         is.setSystemId(source.getURI());
>         var document = parser.parseDocument(is);
> 	cocoon.log.debug (document);
> 	return document;     
>     } 
>     finally {
>         if (source != null)
>             resolver.release(source);
>         cocoon.releaseComponent(parser);
>         cocoon.releaseComponent(resolver);
>     }
> }
> 
> but I am getting a value of null for the document variable.
> How do I find out why the parser is failing to parse the document
> content (which should be perctly valid xml)?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org