You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lionel Crine <cr...@4dconcept.fr> on 2003/12/25 15:38:15 UTC
Re: [A SOLUTION] Validating a document with an action -->
Correction
At 13:43 25/12/2003 +0100, you wrote:
>I wrote an action which can validate an xml document according a DTD.
>
>Here an example :
>
>The ACTION :
>In the act method you can write :
>
>StrDocument = source; --> representing the * of the sitemap.
>
>DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
>DocumentBuilder db = null;
>try {
>db = dbf.newDocumentBuilder();
This line should be before the try.
>dbf.setValidating(true); .
>ErrorHandler handler = (ErrorHandler) new ValidationException();
>db.setErrorHandler(handler);
>db.parse(new InputSource(new
>ByteArrayInputStream(strDocument.getBytes("UTF-8"))));
>return EMPTY_MAP;
>}
>catch (ParserConfigurationException pce) {
>Debugger.println("ValidatingDTD.endElement : Validation Exception");
>pce.printStackTrace();
>return null;
>}
>
>catch (SAXParseException spe) {
>//This Exception is thrown from the ValidationException class.
>Debugger.println("ValidatingDTD.endElement : Validation Exception");
>spe.printStackTrace();
>return null;
>}
>
>the SITEMAP :
>
><!--*** Finish the declaration ***-->
> <map:match pattern="validate/*.xml">
> <map:act type="validateModif" src="{1}.xml">
> <map:parameter name="url_dtd"
> value="modification.dtd" /> --> be sure the DTD will be find.
> <map:generate type="GetDocument" src="{../1}.xml" />
> <map:serialize type="xml" />
> </map:act>
> <map:redirect-to uri="cocoon:/validationFailed"/>
> </map:match>
>
>
>The ValidationException class
>
>it should implements ErrorHandler and you should set three methods :
>
>warning, error, fatalError.
>Here an example of one :
>
>/**
> * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
> */
>public void fatalError(SAXParseException exception) throws SAXException {
>Debugger.println("SAXParseException : Fatal Error");
>Debugger.println("Fatal Error: " + exception.getMessage());
>Debugger.println(" at line " + exception.getLineNumber() + ", column " +
>exception.getColumnNumber());
>Debugger.println(" in entity " + exception.getSystemId());
>exception.printStackTrace();
>throw exception;
>
>
>
>Hope that help..
>
>Lionel
>
>
>
>
>
>Lionel CRINE
>Ingénieur Systèmes documentaires
>Société : 4DConcept
>22 rue Etienne de Jouy 78353 JOUY EN JOSAS
>Tel : 01.34.58.70.70 Fax : 01.39.58.70.70
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
Lionel CRINE
Ingénieur Systèmes documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.58.70.70
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Custom DB-Generator crashes
Posted by Frank Taffelt <fr...@interface-business.de>.
it think you have to close your db connection.
hth,
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Custom DB-Generator crashes
Posted by Geoff Howard <co...@leverageweb.com>.
Mathias Wiegard wrote:
> Hi,
> I wrote a custom db-generator (extends Composer Generator) where I'm
> connecting to a mysql-database to generate SAX-Events for a consumer.
> Exactly after 10 times using a pipeline with the generator (the consumer is
> simply a xml-serializer) cocoon is hanging up. I implemented the connection
> release of the db-connection after every use in a "finally"-block. But I'm
> only releasing the db-selector in the dispose-method. Could there be the
> problem? Does this problem sound familiar to someone of you guys? Any
> Suggestions?
Can you give more information on exactly what Cocoon "does" what is
printed out to screen/standard out (if anything) and what is in the
cocoon logs?
Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Custom DB-Generator crashes
Posted by Mathias Wiegard <Ma...@student.uni-ulm.de>.
Hi,
I wrote a custom db-generator (extends Composer Generator) where I'm
connecting to a mysql-database to generate SAX-Events for a consumer.
Exactly after 10 times using a pipeline with the generator (the consumer is
simply a xml-serializer) cocoon is hanging up. I implemented the connection
release of the db-connection after every use in a "finally"-block. But I'm
only releasing the db-selector in the dispose-method. Could there be the
problem? Does this problem sound familiar to someone of you guys? Any
Suggestions?
Mat
Mathias Wiegard
Sedanstraße 67
89077 Ulm
GERMANY
Fon: +49 (0731) 6031938
Email: mathias.wiegard@student.uni-ulm.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org