cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <Ralph.Go...@dslextreme.com>
Subject Re: XML Validation with FileGenerator
Date Wed, 26 Oct 2005 05:41:42 GMT


Oliver Powell wrote:

> I am using XML from external providers and as part of the business 
> rules I must validate it. I want the SAX parser in the FileGenerator 
> to validate it against its XSD. Ideally, I'd like to be able 
> to localise XML validation to this particular pipeline and generator. 
> For the most part I don't want it enabled. Is there an easy way to do 
> this?  I've also hunted around the source-code and the cocoon-user 
> list for an easy way to do this, but nothing jumped out.
>  
> So far I've only discovered the global "validate=true" switch for the 
> xml-parser in cocoon.xconf, which doesn't help me (the sitemap doesn't 
> even parse, let alone my external xml!). I noticed the comment next to 
> this configuration:
>    
>         "XML validation is only being used for the documentation 
> build. If you are going to use it elsewhere, then do so with caution. 
> You really should have validated all of your XML documents already, 
> according to their proper DTD or schema. Do not expect Cocoon to do it."
>  
> I'm surprised by this statement. I expected an XML-based engine like 
> Cocoon to be more supportive of XML validation. And in my position, 
> with externally-supplied XML, I can't assume my XML has been validated 
> previously. I'd rather not create an intermediate step outside Cocoon 
> to perform this validation either.
>  
> It looks like the FileGenerator (and SourceUtil) doesn't parameterise 
> this, so I suspect I'll have to write my own generator that uses a 
> specially configured second SAXParser with validate=true (I'd rather 
> not mess with the default parser).
>  
> It just seems a shame that I must go to these lengths just to have XML 
> validation in a localised way, so I'm hoping someone on the list has a 
> better suggestion.
>  
> Thanks,
> Ollie
>
Can you wait a week?  Release 2.1.8 will have a validation block that 
includes the ValidatingTransformer. I believe it will achieve what you want.

Ralph

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


Mime
View raw message