Werner, Sorry, late reply.
a) The xsd:any element could be use to specify that the children element can basically contain "anything". b) In my particular case, the content of the children element will always be valid XML. To say it differently, the overall XML document will always be a valid XML document. --- On Fri, 2/27/09, Werner Guttmann <[email protected]> wrote: > From: Werner Guttmann <[email protected]> > Subject: Re: [castor-user] "inject" custom XML in a generated XML > To: [email protected] > Date: Friday, February 27, 2009, 2:29 PM > Thomas, > > a few questions: > > a) How would you model an XML schema to allow bespoke > functionality ? > b) Will the content of children always be valid XML, or > mixed as well ? > > Regards > Werner > > Thomas Cherel wrote: > > Sorry, I should have provided the example in the first > place. > > > > Let's say that I have the following Java class > (getter/setter not included to make it short): > > > > class Person { > > String name; > > String children; > > } > > > > Let's now say that I create the following Person > instance: > > > > Person p = new Person(); > > p.setName("John Doe"); > > > p.setChildren("<name>Marie</name><name>Nolan></name>"); > > > > When marshalling this instance into XML I'd like > the XML document to look as follows: > > > > <person> > > <name>John Doe</name> > > <children> > > > <name>Marie</name><name>Nolan</name> > > </children> > > </person> > > > > The children attribute is already XML and I want this > XML to be included "as is" in the generated XML > document. > > > > > > --- On Thu, 2/26/09, Werner Guttmann > <[email protected]> wrote: > > > >> From: Werner Guttmann > <[email protected]> > >> Subject: Re: [castor-user] "inject" > custom XML in a generated XML > >> To: [email protected] > >> Date: Thursday, February 26, 2009, 3:35 PM > >> Thomas, > >> > >> before trying to provide you with a definitive > answer, can > >> you please > >> give us a short example of what you are trying to > do ? > >> Short, but > >> complete, pretty please. > >> > >> Regards > >> Werner > >> > >> Thomas Cherel wrote: > >>> I did not experiment yet the FieldHandler > capability > >> but I was > >>> wondering if there is a way to use it to > >> "inject" custom XML in a > >>> generated XML doc from a java class. > >>> > >>> What I mean by that is having the ability to > create my > >> own XML chunk > >>> for an attribute of a given Java class and > have this > >> XML chunk > >>> inserted "as is" in the generated > XML (and > >> being part of the overall > >>> XML, meaning without having any encoding of > the XML > >> reserve > >>> characters). > >>> > >>> Based on the documentation it seems that I can > >> certainly create a > >>> string for any Java attribute (using a > FieldHandler) > >> but I am > >>> assuming that if this string is an XML string, > the XML > >> characters > >>> will be XML encoded (e.g. > instead of > >) > >> before they are inserted > >>> in the generated XML. Am I correct and if I > am, is > >> there a way to > >>> overwrite this behavior? > >>> > >>> Thanks. > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >> > --------------------------------------------------------------------- > >>> 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 > > > > > > --------------------------------------------------------------------- > 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

