Matt, if you need any help with regards to writing that HOW-TO, let us know. Simply take any of the existing XML HOW-TOs as a template (e.g.
http://cvs.castor.codehaus.org/viewrep/castor/castor/src/xml-howto/how-to-fetch-dtds-and-schemas-from-jars.xml?r=1.1 and provide us with a patch attached to a Jira issue. Thanks in advance Werner Matt Secoske wrote: > Yeah, I haven't done that yet (not needed like you said), and was kindof > worried about that. I will try some things with it and see what I come > up with. > > No problem on the how-to. I know I spent a good deal of time trying to > figure this out, so I'm sure someone else could find a use for it. > > - Matt > > On 3/29/06, *Stephen Bash* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> > wrote: > > Matt- > > Have you tried marshalling the objects created by Castor using the > same mapping file? If it isn't important to your application, you > probably don't need to worry about it, but I think in the past there > has been a problem with the serializer escaping XML in strings so that > the file doesn't look as expected (lots of < entities floating > around). > > Thanks for working on the how-to! > > Stephen > > > On 3/29/06, Matt Secoske <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Hi Ralf, > > > > It would be my pleasure. > > > > - Matt > > > > > > On 3/29/06, Ralf Joachim < [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > wrote: > > > > > Hi Matt, > > > > how about putting all this information together into a howto > document as > > a payback to the castor project ;-) > > > > Regards > > Ralf > > > > > > Matt Secoske schrieb: > > > Thanks Stephen. I found it: > > > > > > Changed my mapping file to this: > > > > > > ... > > > <field name="innerData" type=" java.lang.Object" > > handler="MyHandler"> > > > <bind-xml name="inner" node="element" /> > > > </field> > > > ... > > > > > > > > > and created a customer generalized handler: > > > --------------------------- > > > import org.exolab.castor.mapping.GeneralizedFieldHandler ; > > > > > > public class MyHandler extends GeneralizedFieldHandler > > > { > > > public MyHandler() { > > > super(); > > > } > > > > > > public Object convertUponGet(Object value) { > > > if (value == null) return null; > > > return value.toString(); > > > } > > > > > > public Object convertUponSet(Object value) { > > > return value.toString(); > > > } > > > > > > public Class getFieldType() { > > > return String.class; > > > } > > > > > > public Object newInstance( Object parent ) > > > throws IllegalStateException > > > { > > > //-- Since it's marked as a string...just return null, > > > //-- it's not needed. > > > return null; > > > } > > > > > > } > > > > > > Thanks for looking at it! > > > > > > > > > On 3/29/06, *Stephen Bash* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>>> > > > wrote: > > > > > > Matt- > > > > > > I haven't used it myself, but I think what you want to look > into is > > > Castor's AnyNode support. I don't know as there is a lot of > > > documentation available, but I think if you search the mail > archives > > > for AnyNode, you might find some helpful discussions. Sorry > I can't > > > be of more help. > > > > > > Stephen > > > > > > > > > On 3/28/06, Matt Secoske < [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > > <mailto: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote: > > > > Hello, > > > > > > > > I am trying to fit this: > > > > > > > > <root> > > > > <inner attribute="innerAttribute"> > > > > <data>Inner Data 1</data> > > > > <data>Inner Data 2</data> > > > > </inner> > > > > <outer>Regular String Data</outer> > > > > <inner2> > > > > <misc>Misc xml to be dealt with later</misc> > > > > </inner2> > > > > </root> > > > > > > > > into this: > > > > > > > > package bizobj; > > > > > > > > public class Root { > > > > String innerData; > > > > String outerData; > > > > Object innerData2; > > > > > > > > public String getInnerData() { > > > > return innerData; > > > > } > > > > public void setInnerData(String innerData) { > > > > this.innerData = innerData; > > > > } > > > > public String getOuterData() { > > > > return outerData; > > > > } > > > > public void setOuterData(String outerData) { > > > > this.outerData = outerData; > > > > } > > > > public Object getInnerData2() { > > > > return innerData2; > > > > } > > > > public void setInnerData2(Object innerData2) { > > > > this.innerData2 = innerData2; > > > > } > > > > } > > > > > > > > > > > > ... and the mapping file I am using: > > > > > > > > <?xml version="1.0"?> > > > > <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD > Version > > > 1.0//EN" > > > > > > > > "http://castor.org/mapping.dtd "> > > > > <mapping> > > > > > > > > <class name=" bizobj.Root"> > > > > <field name="innerData" type="string" > > > > > <bind-xml name="inner" node="element" /> > > > > </field> > > > > > > > > <field name="outerData" type="string"> > > > > <bind-xml name="outer" node="element" /> > > > > </field> > > > > > > > > <field name="innerData2" type="java.lang.Object"> > > > > <bind-xml name="inner2" node="element" /> > > > > </field> > > > > </class> > > > > </mapping> > > > > > > > > > > > > So, innerData2 (java.lang.Object ) works just fine, while > I cannot > > > seem to > > > > get innerData (string) to work, regardless of handlers or > > > config. Using the > > > > innerData2 (Object) approach will not work for various > external > > > reasons... > > > > Any ideas? > > > > > > > > Regards, > > > > -- > > > > Matt Secoske > > > > > > > > > > > > > > > -- > > > Matt Secoske > > > http://blog.secosoft.net > > > > -- > > > > Syscon Ingenieurb�ro f�r > > Me�- und Datentechnik GmbH > > Ralf Joachim > > Raiffeisenstra�e 11 > > > > D-72127 Kusterdingen > > Germany > > > > Tel. +49 7071 3690 52 > > Mobil: +49 173 9630135 > > Fax +49 7071 3690 98 > > > > Email: [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > Web: www.syscon-world.de <http://www.syscon-world.de> > > > > ------------------------------------------------- > > If you wish to unsubscribe from this list, please > > send an empty message to the following address: > > > > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > ------------------------------------------------- > > > > > > > > > > -- > > Matt Secoske > > http://blog.secosoft.net > > > > > -- > Matt Secoske > http://blog.secosoft.net ------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] -------------------------------------------------

