You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ge...@mckinsey.com on 2002/07/17 19:48:50 UTC

Can Cocoon 2 do XML validation?

I'm been looking around on the cocoon site and the mailing list archive but
just can't seem to find out how to make cocoon validate xml against a
schema somewhere on the net.  Each XML document would have a different
schema to validate against as there are 6 categories and the schema is
already encoded in the XML as
<metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://somewhere/metadata.xsd">
in the root element.  Any help would be greatly appreciated.

Thanks,
-Gerardo

+---------------------------------------------------------+
This message may contain confidential and/or privileged
information.  If you are not the addressee or authorized to
receive this for the addressee, you must not use, copy,
disclose or take any action based on this message or any
information herein.  If you have received this message in
error, please advise the sender immediately by reply e-mail
and delete this message.  Thank you for your cooperation.
+---------------------------------------------------------+


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: Can Cocoon 2 do XML validation?

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Gerardo_Flores@mckinsey.com [mailto:Gerardo_Flores@mckinsey.com]
> 
> I'm been looking around on the cocoon site and the mailing list
archive but
> just can't seem to find out how to make cocoon validate xml against a
> schema somewhere on the net. 

>From cocoon.xconf:

----------- 8< -----------
  <xml-parser class="org.apache.avalon.excalibur.xml.JaxpParser"
              logger="core.xml-parser">
  <!-- Parser:
    The default parser used in Apache Cocoon is
    org.apache.avalon.excalibur.xml.JaxpParser. Apache Cocoon requires a

    JAXP 1.1 parser.
    If you have problems because your servlet environment uses its own
    parser not conforming to JAXP 1.1 try using the alternative
    XercesParser instead of the JaxpParser. To activate the
XercesParser,
    change the class attribute to
      class="org.apache.avalon.excalibur.xml.XercesParser"
    You will also need to add a system property to your JVM,
    probably on the startup of your servlet engine like this:
 
-Dorg.apache.avalon.excalibur.xml.Parser=org.apache.avalon.excalibur.xml
.XercesParser

    Configuration for the JaxpParser (not the XercesParser!):
    - validate (boolean, default = false): This parameter causes the
parser 
        to be a validating parser.
        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.
    - namespace-prefixes (boolean, default = false) : do we want
        namespaces declarations also as 'xmlns:' attributes ?
        Note : setting this to true confuses some XSL processors (e.g.
Saxon).
    - stop-on-warning (boolean, default = true) : should the parser
        stop parsing if a warning occurs ?
    - stop-on-recoverable-error (boolean, default = true) : should the
parser
        stop parsing if a recoverable error occurs ?
----------- 8< -----------

... and lots more.


Vadim


> Each XML document would have a different
> schema to validate against as there are 6 categories and the schema is
> already encoded in the XML as
> <metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="http://somewhere/metadata.xsd">
> in the root element.  Any help would be greatly appreciated.
> 
> Thanks,
> -Gerardo


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>