Keith,

Thanks for the info.

Could you give me pointers in how to modify & build from 
org/exolab/castor/mapping/mapping.xsd?  Specifically my questions are:

1) there is no ant task to use the SourceGenerator and regenerate the 
com.exolab.castor.mapping.xml package.  I ran it by hand, but noticed way to many 
changes between the newly generated source and the previous source.  Most of these 
changes were, I believe, because the source in the distribution was generated with 
Castor 0.8.12.  Should I use that version when I try my experiments.

2) Are the mapping.xsd and mapping.dtd files manually reconciled or is there some way 
you generate one from the other?

3) I don't understand how to modify the mapping.xsd and use a property to allow the 
functionality to be optionally included.  Am I missing something.

Again, thanks much for the help.

Kevin

-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 15, 2004 4:53 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] problem with marshal behavior of default
attribute values



Kevin,

If you go down this path, make sure you make your changes an "option" in
the castorbuilder.properties file (if you're going to be modifying the
source generator") or the castor.properties file (if you're going to be
modifying the marshaller or mapping framework).
(see LocalConfiguration.java and Configuration.java in the castor.util
package.)

As far as pointers go, it depends on how you want to approach it. From a
Schema/SourceGenerator stand point, you'll want to look at
FieldInfo.java, SourceFactory.java and MemberFactory.java all in the
org/exolab/castor/builder package.

>From a Mapping file perspective it's a little more cross package. You'll
need to look a bit into various files of the mapping API
(org.exolab.castor.mapping), the XMLMappingLoader and probably even the
Marshaller (org.exolab.castor.xml).

--Keith


"Ruland, Kevin S [ITS]" wrote:
> 
> Rhett,
> 
> Thanks for pointing me to that thread on the list.  Glad I'm not off base.
> 
> My real motivation for this is to use the dynamically generated (ie runtime) mapping 
> file and specifying the default value in the <bind-xml> tag.
> 
> If you could point me to some rational starting places in the code, I'd be happy to 
> give it a shot.
> 
> Kevin
> 
> -----Original Message-----
> From: Rhett Sutphin [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 15, 2004 8:58 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] problem with marshal behavior of default
> attribute values
> 
> Hi Kevin,
> 
> Comments below.
> 
> Ruland, Kevin S [ITS] wrote:
> > I'm working with a document with optional attributes with defined
> > default values.  Previously I posted a question on this topic when using
> > a custom mapping file and dynamically generated mappings.  The
> > suggestion was to use the source generator.  Indeed the source generator
> > has better behavior but is still slightly bugged because it will
> > unmarshal attributes which have the default value.
> >
> > What I expect to happen is if the object's attribute has the default
> > value, I would not expect it to be unmarshalled.  What I find though is
> > the marshaller will print the attribute as long as it has been set.
> > Technically this is not incorrect behavior because the resulting
> > document is valid.  However, it is counter intuitive.
> >
> > I am using this extremly simple schema for my example:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema
> >    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> >    elementFormDefault="qualified">
> >
> > <xsd:element name="AnElement">
> >   <xsd:complexType>
> >     <xsd:attribute name="name" type="xsd:string" use="required"/>
> >     <xsd:attribute name="default-true" type="xsd:boolean" default="true"/>
> >     <xsd:attribute name="default-false" type="xsd:boolean"
> > default="false"/>
> >  </xsd:complexType>
> > </xsd:element>
> >
> > </xsd:schema>
> >
> > With the original source document of:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <AnElement name="tuesday" default-true="false"/>
> >
> > My simple little Main program, unmarshals this, then sets "default-true"
> > to "true" and marshalls it.
> >
> > I get:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <AnElement name="tuesday" default-true="true"/>
> >
> > What I'm asking is, are my expectations unrealisitic?  What's the
> > complexity of trying to put the default value as specified in the schema
> > in the FieldDescriptor or FieldHandler and using that to both initialize
> > the object (prior to unmarshalling) and in the 'hasXXX()' methods?
> 
> Your expectations are fine -- it wouldn't be terribly hard to achieve the effect you 
> desire -- it's just that no one has volunteered to do it.  There was a thread about 
> this a while back in which some implementation alternatives were discussed: 
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg14065.html .  If you want to give 
> it a shot, I'm sure there are others who'd be interested.
> 
> Rhett Sutphin
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

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

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

Reply via email to