Danny,

can you please search for a Jira issue at 
http://jira.codehaus.org/browse/CASTOR to see whether somebody else reported 
a similar (if not the same) problem.

Thanks
Werner

On Wed, 19 Oct 2005 08:00:15 -0400, Danny Collins wrote:

>I was looking around the castor site and I couldn't find anything to
>tell me why the validation changed after 0.9.6. Any body have a clue?
>
>On 10/14/05, Danny Collins <[EMAIL PROTECTED]> wrote:
>> OK - here is something a little bizarre.
>>
>> 0.9.6 generates code in the descriptor class that has maxlength validation
>>
>> 0.9.7 and 0.9.9 do not. I'm not sure if this is a bug or if I am now
>> missing something in my build file or my castor properties to get the
>> same behavior out of the later releases.
>>
>>
>> Any ideas?
>>
>> On 10/14/05, Danny Collins <[EMAIL PROTECTED]> wrote:
>> > that's what I thought! and I am using the SourceGenerator.
>> >
>> > OK - I think this may be part of my problem - here is a snippet of the 
>> > schema
>> >
>> >         <xsd:complexType name="C-14">
>> >                 <xsd:simpleContent>
>> >                         <xsd:extension base="C-14_NoID">
>> >                                 <xsd:attribute name="id" type="ID"/>
>> >                         </xsd:extension>
>> >                 </xsd:simpleContent>
>> >         </xsd:complexType>
>> >         <xsd:simpleType name="C-14_NoID">
>> >                 <xsd:restriction base="xsd:string">
>> >                         <xsd:maxLength value="14"/>
>> >                         <xsd:minLength value="1"/>
>> >                 </xsd:restriction>
>> >         </xsd:simpleType>
>> >
>> >
>> > I am trying to get the C-14 type to validate, except the restriction
>> > is on the C-14_NoID node, and when I look at the Descriptor class the
>> > getExtends is always null. Which is why I think that I'm not getting
>> > the validation I think I should be getting.
>> >
>> > No objects are generated that have anything to do with C-14_NoID.
>> >
>> > Do I need to let the sourcegenerator know anything special to get it
>> > to generate the extended nodes?
>> >
>> >
>> > Thanks again for the help!
>> > Danny
>> >
>> > On 10/13/05, Keith Visco <[EMAIL PROTECTED]> wrote:
>> > >
>> > > Danny,
>> > >
>> > > Castor will, by default, validate the object model prior to the
>> > > marshalling process. If you're using the source generator then the
>> > > generated descriptors contain some validation attributes that Castor
>> > > will use during this validation process. If you're not using the source
>> > > generator you'd have to create your own validators or validation step.
>> > >
>> > > Castor's object model validation is not as "complete" as validating the
>> > > XML itself with the parser, but it should provide you with the basic
>> > > property level validation, so in your situation the strings that are too
>> > > long should be validated by Castor's object model validation process.
>> > >
>> > > If you open up the *Descriptor.java files you'll see the validation code
>> > > to give you an idea of what Castor will validate against.
>> > >
>> > > --Keith
>> > >
>> > >
>> > >
>> > >
>> > > Danny Collins wrote:
>> > > > AHA! Yeah I am trying to go from Java->XML and get the same level of
>> > > > validation that you would get when you go form XML->JAVA.
>> > > >
>> > > > We are already exploring adding in our own validation step. I was just
>> > > > hoping to leverage anything that castor provided.
>> > > >
>> > > > thanks
>> > > > Danny
>> > > >
>> > > > On 10/13/05, Stephen Bash <[EMAIL PROTECTED]> wrote:
>> > > >
>> > > >>Danny-
>> > > >>
>> > > >>Are you validating during xml->java or java->xml?  The properties given
>> > > >>tell the xml parser to validate against a given schema, but during
>> > > >>java->xml, I don't believe the parser is utilized (there might be an
>> > > >>option that I don't know about).  My first idea would be to generate 
>> > > >>the
>> > > >>xml from the java objects, and then run that xml through a validating
>> > > >>parser to determine if the xml conforms to the schema.
>> > > >>
>> > > >>I should mention that I don't use the source generator much at all, so
>> > > >>there may be options in there to help with validation that I don't know
>> > > >>about.
>> > > >>
>> > > >>Stephen
>> > > >>
>> > > >>
>> > > >>Danny Collins wrote:
>> > > >>
>> > > >>>OK - popped those attributes into my properties file - regenerated the
>> > > >>>source code and the fed the objects a ton of invalid data - mainly
>> > > >>>strings that are WAY too long and should fail validation and will if I
>> > > >>>do
>> > > >>>
>> > > >>>I've attached my castor properties file.
>> > > >>>
>> > > >>>I am trying to validate an individual object in the castor graph -
>> > > >>>that is a piece of the schema.
>> > > >>>
>> > > >>>do I need to build out the entire object graph in order for it to
>> > > >>>validate correctly?
>> > > >>>
>> > > >>>Thanks again, you all are being very helpful!
>> > > >>>Danny
>> > > >>>
>> > > >>>On 10/13/05, Danny Collins <[EMAIL PROTECTED]> wrote:
>> > > >>>
>> > > >>>
>> > > >>>>SWEET! Thanks for pointing this out. I am going to give it a go
>> > > >>>>straight away and let you know if it works out for me!
>> > > >>>>
>> > > >>>>Thanks again guys.
>> > > >>>>
>> > > >>>>On 10/13/05, Werner Guttmann <[EMAIL PROTECTED]> wrote:
>> > > >>>>
>> > > >>>>
>> > > >>>>>Yes, as recently added to the XML F.A.Q. (though not released yet):
>> > > >>>>>
>> > > >>>>><p>To enable XML validation at the parser level, please add 
>> > > >>>>>properties
>> > > >>>>>to your
>> > > >>>>><tt>castor.properties</tt> file as follows:</p>
>> > > >>>>>
>> > > >>>>><code>
>> > > >>>>>       org.exolab.castor.parser.namespaces=true
>> > > >>>>>
>> > > >>>>>org.exolab.castor.sax.features=http://xml.org/sax/features/validation,\
>> > > >>>>>
>> > > >>>>>http://apache.org/xml/features/validation/schema,\
>> > > >>>>>
>> > > >>>>>http://apache.org/xml/features/validation/schema-full-checking
>> > > >>>>></code>
>> > > >>>>>
>> > > >>>>><p>Please note that the example given relies on the use of Apache
>> > > >>>>>Xerces, hence the
>> > > >>>>><tt>apache.org</tt> properties; similar options should exist for 
>> > > >>>>>other
>> > > >>>>>parsers.</p>
>> > > >>>>>
>> > > >>>>>
>> > > >>>>>I hope this helps
>> > > >>>>>Werner
>> > > >>>>>
>> > > >>>>>wg> -----Original Message-----
>> > > >>>>>wg> From: Danny Collins [mailto:[EMAIL PROTECTED]
>> > > >>>>>wg> Sent: Thursday, October 13, 2005 3:49 PM
>> > > >>>>>wg> To: [email protected]
>> > > >>>>>wg> Subject: Re: [castor-user] Schema Validation
>> > > >>>>>wg>
>> > > >>>>>wg> My original thought was that a call to validate prior to
>> > > >>>>>wg> Marshal would work. But that doesn't seem to do anything.
>> > > >>>>>wg> Then I found a reference to a property in the
>> > > >>>>>wg> castor.properties file called
>> > > >>>>>wg>
>> > > >>>>>wg> org.exolab.castor.marshalling.validation
>> > > >>>>>wg>
>> > > >>>>>wg> that I have tried with true and false to no avail.
>> > > >>>>>wg>
>> > > >>>>>wg> Any thing else that I should know about?
>> > > >>>>>wg>
>> > > >>>>>wg>
>> > > >>>>>wg> TIA
>> > > >>>>>wg> Danny
>> > > >>>>>wg>
>> > > >>>>>wg> On 10/13/05, Werner Guttmann <[EMAIL PROTECTED]> wrote:
>> > > >>>>>wg> > Danny,
>> > > >>>>>wg> >
>> > > >>>>>wg> > No, you are not. How are you instructing the XML parser
>> > > >>>>>wg> (via Castor)
>> > > >>>>>wg> > to use XML Schema validation ?
>> > > >>>>>wg> >
>> > > >>>>>wg> > Werner
>> > > >>>>>wg> >
>> > > >>>>>wg> > wg> -----Original Message-----
>> > > >>>>>wg> > wg> From: Danny Collins [mailto:[EMAIL PROTECTED]
>> > > >>>>>wg> > wg> Sent: Wednesday, October 12, 2005 1:35 PM
>> > > >>>>>wg> > wg> To: [email protected]
>> > > >>>>>wg> > wg> Subject: [castor-user] Schema Validation
>> > > >>>>>wg> > wg>
>> > > >>>>>wg> > wg> Hello,
>> > > >>>>>wg> > wg>
>> > > >>>>>wg> > wg> I seem to be having problems getting the my objects 
>> > > >>>>>validated
>> > > >>>>>wg> > wg> against the schema - it seems to be able to tell me if I 
>> > > >>>>>am
>> > > >>>>>wg> > wg> missing required objects, but it doesn't seem to be able 
>> > > >>>>>to
>> > > >>>>>wg> > wg> validate other restrictions like maxlength. Am I
>> > > >>>>>wg> misinterpreting
>> > > >>>>>wg> > wg> the validation abilities?
>> > > >>>>>wg> > wg>
>> > > >>>>>wg> > wg>
>> > > >>>>>wg> > wg> TIA
>> > > >>>>>wg> > wg> Danny
>> > > >>>>>wg> > wg>
>> > > >>>>>wg> > wg> -------------------------------------------------
>> > > >>>>>wg> > wg> If you wish to unsubscribe from this list, please
>> > > >>>>>wg> send an empty
>> > > >>>>>wg> > wg> message to the following address:
>> > > >>>>>wg> > wg>
>> > > >>>>>wg> > wg> [EMAIL PROTECTED]
>> > > >>>>>wg> > wg> -------------------------------------------------
>> > > >>>>>wg> > wg>
>> > > >>>>>wg> > wg>
>> > > >>>>>wg> >
>> > > >>>>>wg> > -------------------------------------------------
>> > > >>>>>wg> > If you wish to unsubscribe from this list, please send an 
>> > > >>>>>empty
>> > > >>>>>wg> > message to the following address:
>> > > >>>>>wg> >
>> > > >>>>>wg> > [EMAIL PROTECTED]
>> > > >>>>>wg> > -------------------------------------------------
>> > > >>>>>wg> >
>> > > >>>>>wg> >
>> > > >>>>>wg>
>> > > >>>>>wg> -------------------------------------------------
>> > > >>>>>wg> If you wish to unsubscribe from this list, please send an
>> > > >>>>>wg> empty message to the following address:
>> > > >>>>>wg>
>> > > >>>>>wg> [EMAIL PROTECTED]
>> > > >>>>>wg> -------------------------------------------------
>> > > >>>>>wg>
>> > > >>>>>wg>
>> > > >>>>>
>> > > >>>>>-------------------------------------------------
>> > > >>>>>If you wish to unsubscribe from this list, please
>> > > >>>>>send an empty message to the following address:
>> > > >>>>>
>> > > >>>>>[EMAIL PROTECTED]
>> > > >>>>>-------------------------------------------------
>> > > >>>>>
>> > > >>>>>
>> > > >>>>
>> > > >>>
>> > > >>>------------------------------------------------------------------------
>> > > >>>
>> > > >>>-------------------------------------------------
>> > > >>>If you wish to unsubscribe from this list, please
>> > > >>>send an empty message to the following address:
>> > > >>>
>> > > >>>[EMAIL PROTECTED]
>> > > >>>-------------------------------------------------
>> > > >>
>> > > >>-------------------------------------------------
>> > > >>If you wish to unsubscribe from this list, please
>> > > >>send an empty message to the following address:
>> > > >>
>> > > >>[EMAIL PROTECTED]
>> > > >>-------------------------------------------------
>> > > >>
>> > > >>
>> > > >
>> > > >
>> > > > -------------------------------------------------
>> > > > If you wish to unsubscribe from this list, please
>> > > > send an empty message to the following address:
>> > > >
>> > > > [EMAIL PROTECTED]
>> > > > -------------------------------------------------
>> > > >
>> > > >
>> > >
>> > >
>> > > -------------------------------------------------
>> > > If you wish to unsubscribe from this list, please
>> > > send an empty message to the following address:
>> > >
>> > > [EMAIL PROTECTED]
>> > > -------------------------------------------------
>> > >
>> > >
>> >
>>
>> -------------------------------------------------
>> If you wish to unsubscribe from this list, please
>> send an empty message to the following address:
>>
>> [EMAIL PROTECTED]
>> -------------------------------------------------
>>
>>
>
>-------------------------------------------------
>If you wish to unsubscribe from this list, please 
>send an empty message to the following address:
>
>[EMAIL PROTECTED]
>-------------------------------------------------
>





-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to