Chris, before looking at your question, let me ask you something. Do you have an XML schema available that reflects your desired XML document structure ? If yes, why not use the XML code generator to generate Java classes (and descriptor classes) from your code, and let Castor handle everything automatically for you ?
This approach should be far easier than writing a mapping file for such scenarios where <xs:any> are allowed in an XML schema. Regards Werner Chris Young wrote: > Hi all, > > I'm new to Castor so you'll have to forgive me if this is a dumb > question! :) Given the sample XML and mapping below, is there any way of > preventing the <input> element which appears within the <custom> element > from being unmarshalled using the Input class? The primary reason for > doing this is that the contents of <custom> are arbitrary (hence the use > of AnyNode). It just so happens that in this case the element happens to > match a previously defined element name. > > Sample XML: > > <device> > <input> > <!-- 'input' children omitted for brevity. --> > </input> > <output> > <!-- 'output' children omitted for brevity. --> > </output> > <custom name="theName" type="theType"> > <input> > <!-- 'input' children omitted for brevity. --> > </input> > </custom> > </device> > > > Sample Mappings: > > <class name="Input"> > <map-to xml="input" /> > <!-- Fields omitted for brevity. --> > </class> > > <class name="Custom"> > <map-to xml="custom" /> > <field name="name" direct="true" required="true"> > <bind-xml name="name" node="attribute"/> > </field> > <field name="type" direct="true" required="true"> > <bind-xml name="type" node="attribute"/> > </field> > <field name="data" direct="true" required="true" > type="org.exolab.castor.types.AnyNode"> > <bind-xml matches="*"/> > </field> > </class> > > Any help appreciated! > > Regards, > Chris > > _______________________________________________ > This email has been scanned for Softel by Star. > > --------------------------------------------------------------------- > 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

