You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Oliver Powell <Ol...@tvnz.co.nz> on 2005/10/26 02:27:51 UTC

XML Validation with FileGenerator

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


=====================================================================
CAUTION: This e-mail and any attachment(s) contains information that
is intended to be read only by the named recipient(s). It may contain
information that is confidential, proprietary or the subject of legal
privilege. This information is not to be used by any other person
and/or organisation. If you are not the intended recipient, please
advise us immediately and delete this e-mail from your system. Do not
use any information contained in it.

================================================================
For more information on the Television New Zealand Group, visit us
online at http://www.tvnz.co.nz
================================================================

Re: XML Validation with FileGenerator

Posted by Ralph Goers <Ra...@dslextreme.com>.

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