cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lionel Crine <cr...@4dconcept.fr>
Subject Re: Validating XML
Date Mon, 24 Nov 2003 11:32:44 GMT
I wrote an action validation an XML document according a DTD.
Here is it the main part :


DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(true);
DocumentBuilder db = null;
try {
db = dbf.newDocumentBuilder();
ErrorHandler handler = (ErrorHandler) new ValidationException();  --> this 
is a custom exception (implements from ErrorHandler)
db.setErrorHandler(handler);
db.parse(new InputSource(new 
ByteArrayInputStream(strDocument.getBytes("UTF-8"))));
return AbstractAction.EMPTY_MAP;
}
catch (ParserConfigurationException pce) {
Debugger.println("ValidatingDTDAction.act : Parser Configuration Exception");
pce.printStackTrace();
return null;
}
catch (SAXParseException spe) {
Debugger.println("ValidatingDTDAction.ect: SAXParser Exception Exception");
//spe.printStackTrace();
return null;
}

I think I've already posted a message about that, you should search the 
archive.

Lionel

At 13:16 20/11/2003 +0100, you wrote:

>Hi all,
>
>
>
>In order to increase the quality control of my app, does anyone know if 
>there is any easy method of checking that the HTML generated is valid, and 
>the XML in each pipeline step conforms certain schema or DTD?
>
>
>
>In a production environment it would be switched off.
>
>--------
>
>David
>
>

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


Mime
View raw message