For starters, it doesn't make much sense to ask (by way of castor.properties)
for both parser validation (...parser.validation=true) and Castor validation 
(...marshalling.validation=true).  
You only need one of these set to 'true'.  Setting both to 'true' will just waste 
cycles.

Could you post a small-as-possible example so we can have a first-hand look at the 
namespace issues?

Thanks,

Erik

      > -----Original Message-----
      > From: Clive Hughes [mailto:[EMAIL PROTECTED]
      > Sent: Wednesday, September 03, 2003 12:12 PM
      > To: [EMAIL PROTECTED]
      > Subject: Re: [castor-dev] Validating XML documents and 
      > namespaces
      > 
      > 
      > Thanks Erik, however...
      > 
      > I removed the namespace prefix problem using the 
      > xsi:noNameSpaceSchemaLocation attribute in the XML 
      > document e.g.:
      > 
      > <AccCard xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
      > xsi:noNamespaceSchemaLocation="AccCard.xsd">
      > ...
      > </AccCard>
      > 
      > castor.properties has the following set:
      > 
      > org.exolab.castor.parser.validation=true
      > org.exolab.castor.parser.namespaces=true
      > org.exolab.castor.marshalling.validation=true
      > 
      > # Comma separated list of SAX 2 features that should be enabled
      > # for the default parser.
      > #
      > org.exolab.castor.features=http://xml.org/sax/features/v
      > alidation,http://apache.org/xml/features/validation/schema
      > 
      > Now I get an org.xml.sax.SAXException: Parsing Error : 
      > Document is invalid: 
      > no grammar found.
      > 
      > which suggests it cannot find a DTD or XSD.  However, 
      > the SAX 2 features 
      > have been set telling SAX to use schema validation in 
      > the pipeline, right?.  
      > I am confused.  BTW: I am using Xerces 2.5 which I check using 
      > org.apache.xerces.impl.Version.
      > 
      > Thanks again for any help
      > Clive
      > 
      > 
      > 
      > >From: "Ostermueller, Erik" <[EMAIL PROTECTED]>
      > >Reply-To: [EMAIL PROTECTED]
      > >To: [EMAIL PROTECTED]
      > >Subject: Re: [castor-dev] Validating XML documents and 
      > namespaces
      > >Date: Tue, 2 Sep 2003 08:47:10 -0500
      > >
      > >
      > >
      > >       > -----Original Message-----
      > >       > From: Clive Hughes [mailto:[EMAIL PROTECTED]
      > >       > Sent: Monday, September 01, 2003 11:43 AM
      > >       > To: [EMAIL PROTECTED]
      > >       > Subject: [castor-dev] Validating XML 
      > documents and namespaces
      > >       >
      > >       >
      > >       > I am using Castor 0.9.5 and am only interested in
      > >       > unmarshalling at the
      > >       > moment.  I can correctly unmarshal an XML 
      > document that
      > >       > is not validated or
      > >       > has no namespace details.
      > >       > However, moving on to validate and to handle
      > >       > namespaces, I run into
      > >       > difficulty.  Sample of the XML below:
      > >       >
      > >       > <?xml version="1.0" encoding="UTF-8"?>
      > >       > <AccCard>
      > >       >   <Header>
      > >       >     <Filename>abc.xml</Filename>
      > >       >     <UserID>fred_bloggs</UserID>
      > >       >   </Header>
      > >       > </AccCard>
      > >       >
      > >       > Firstly assume the submitted document is not 
      > validated.
      > >       >  How can I prompt
      > >       > Castor to validate it against, say, AccCard.xsd on my
      > >       > local filesystem.
      > >Look at the castor.properties files.  Here is a snippet:
      > ># True if xml documents should be validated by the SAX Parser
      > >#
      > >org.exolab.castor.parser.validation=false
      > >org.exolab.castor.parser.namespaces=false
      > >
      > >If you use .java files generated by the SourceGenerator,
      > >you can use Castor schema validatoin, which is a lot 
      > faster than the 
      > >parser's validation.
      > >Use this property from the same file:
      > ># True if all documents should be validated by the 
      > marshalling framework
      > >#
      > >org.exolab.castor.marshalling.validation=true
      > >
      > >
      > >       >
      > >       > Secondly how would I get Castor to handle the case
      > >       > where a user submits this
      > >       > document with namespace information e.g.
      > >Look at the nspackages attribute in the 
      > castorbuilder.properties file:
      > ># XML namespace mapping to Java packages
      > >#
      > >#org.exolab.castor.builder.nspackages=\
      > >   http://www.xyz.com/schemas/project=com.xyz.schemas.project,\
      > >   http://www.xyz.com/schemas/person=com.xyz.schemas.person
      > >
      > >Again, this is if you use the SourceGenerator.
      > >If you don't, the mapping file can help.
      > >
      > >
      > >
      > >       >
      > >       > <?xml version="1.0" encoding="UTF-8"?>
      > >       > <p:AccCard xmlns:p="urn:nmspace.co.uk"
      > >       > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      > >       > xsi:schemaLocation="urn:nmspace.co.uk 
      > ChargeCard.xsd ">
      > >       >   <p:Header>
      > >       >     <p:Filename>abc.xml</p:Filename>
      > >       >     <p:UserID>fred_bloggs</p:UserID>
      > >       >   <p:/Header>
      > >       > <p:/AccCard>
      > >       >
      > >       > i.e. how do I handle (ignore) the xmlns attributes and
      > >       > p: namespace
      > >       > prefixes?  My current mapping (which works 
      > fine without
      > >       > the p: prefix)
      > >       > doesn't handle this.
      > >       >
      > >       > Any help is appreciated, thanks
      > >       >
      > >       > Clive
      > >       >
      > >       > 
      > ________________________________________________________
      > >       > _________
      > >       > Use MSN Messenger to send music and pics to 
      > your friends
      > >       > http://www.msn.co.uk/messenger
      > >       >
      > >       > 
      > -----------------------------------------------------------
      > >       > If you wish to unsubscribe from this mailing, 
      > send mail to
      > >       > [EMAIL PROTECTED] with a subject of:
      > >       >         unsubscribe castor-dev
      > >       >
      > >       >
      > >       > DISCLAIMER:
      > >       > This email message is for the sole use of the intended
      > >       > recipient(s) and may contain confidential and
      > >       > privileged information.  Any unauthorized review, use,
      > >       > disclosure or distribution is prohibited.  If you are
      > >       > not the intended recipient, please contact the sender
      > >       > by reply email and destroy all copies of the original
      > >       > message and attachments.
      > >       >
      > >
      > >-----------------------------------------------------------
      > >If you wish to unsubscribe from this mailing, send mail to
      > >[EMAIL PROTECTED] with a subject of:
      > >         unsubscribe castor-dev
      > >
      > 
      > ________________________________________________________
      > _________
      > Express yourself with cool emoticons - download MSN 
      > Messenger today! 
      > http://www.msn.co.uk/messenger
      > 
      > ----------------------------------------------------------- 
      > If you wish to unsubscribe from this mailing, send mail to
      > [EMAIL PROTECTED] with a subject of:
      >         unsubscribe castor-dev
      > 
      > 
      > DISCLAIMER:
      > This email message is for the sole use of the intended 
      > recipient(s) and may contain confidential and 
      > privileged information.  Any unauthorized review, use, 
      > disclosure or distribution is prohibited.  If you are 
      > not the intended recipient, please contact the sender 
      > by reply email and destroy all copies of the original 
      > message and attachments.
      > 

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to