1) auto-complete:

*auto-complete*: if true, the class will be introspected to determine its field 
and the fields specified in the mapping file will be used to override the field 
found during the introspection.

2) location attribute: 

The location attribute (as per 
http://castor.org/xml-mapping.html#6.-Location-attribute) does exist in the 
field mapping only. In other words, when specifying a field mapping for a 
(collection) member, you might actually 'inject' an arbitrary XPATH prefix to 
the actual field name (or corresponding XML name).

I hope this helps.
Werner

________________________________________
Von: Jon Wilmoth [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 29. März 2007 16:51
An: [email protected]
Betreff: Re: AW: [castor-user] XML binding

I thought I could control the "Castor XML introspector approach for all classes 
not mapped" by setting the class "auto-complete attribute" to false.  Is this 
not the case?
 
The location attribute sounds like a great way to ignore elements in an 
existing schema.  This would definitely work for some of the lower elements, 
but unfortunately this doesn't look like it works with the <map-to> element.  
What I think I need is something like this:
 
<class name="com.mypackage.Gateway" auto-complete="false">
 <map-to xml="config/gateway"/>
 <field name="name" type="java.lang.String">
     <bind-xml name="name" node="element"/>
 </field>
</class>
or 

<class name="com.mypackage.Gateway" auto-complete="false">
 <map-to xml="gateway" location="config"/>
 <field name="name" type="java.lang.String">
     <bind-xml name="name" node="element"/>
 </field>
</class>
 
Thanks,
Jon
----- Original Message ----
From: Werner Guttmann <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, March 29, 2007 12:18:46 AM
Subject: AW: [castor-user] XML binding
Hi,

If you don't provide a mapping for all classes involved, Castor XML will use an 
introspector approach for all classes not mapped (using some default naming 
conventions for working out member names etc.). 

To be honest, the error message 'unable to find FieldDescriptor for 'gateway' 
in ClassDescriptor of gateway' somehow does not make sense, but this might be a 
result of working in that 'mixed' mode.

Regards
Werner Guttmann

PS If you do not intend to provide a separate Java class (and a mapping) for 
the <config> element, you might want to consider the use of the location 
attribute (if applicable).

> -----Ursprüngliche Nachricht-----
> Von: Jon Wilmoth [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 29. März 2007 01:39
> An: [email protected]
> Betreff: [castor-user] XML binding
> 
> I'm having problems mapping an existing XML document to existing classes
> using castor-0.9.5.3 and I'd like to know if I'm simply not doing
> something right or if the functionality doesn't exist in the version I'm
> using.
> With an XML doc something like:
> 
> <config>
>  <gateway>
>   <name></name>
>   <url></url>
>   <action>
>    <name></name>
>    <ID></ID>
>   </action>
>   <action>
>    <name></name>
>    <ID></ID>
>   </action>
>  </gateway>
> </config>
> 
> I'm trying unmarshal some elements, but not all to a class, but I'm
> getting an org.xml.sax.SAXException: unable to find FieldDescriptor for
> 'gateway' in ClassDescriptor of gateway".  I thought I'd start small, but
> the even the following mapping file won't unmarshall.
> 
> <class name="com.mypackage.Gateway" auto-complete="false">
>  <map-to xml="gateway"/>
>  <field name="name" type="java.lang.String">
>   <bind-xml name="name" node="element"/>
>  </field>
> </class>
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to