Sorry to dig up an own thread. I also have a similar requirement and wondered if the original author ever found a way to do this?
Thomas Cherel wrote: > > > > For b), ideally I'd like to be able to insert anything I want as long as I > guarantee that the overall XML doc is still well-formed. > Now, if there is an "easy" way to do that with the restriction that there > should be a single XML root element containing anything else I want, I > think I can live with it :-) > > --- On Thu, 3/5/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, March 5, 2009, 7:57 AM >> Thomas Cherel wrote: >> > Werner, >> > >> > Sorry, late reply. >> > >> > a) The xsd:any element could be use to specify that >> the children >> > element can basically contain "anything". >> Okay. >> >> > 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. >> Okay. Let me rephrase my question, then. Will you - at any >> time - only >> insert one XML element (which might itself carry complex >> XML structure >> internally), or more than one element, or even XML mixed >> with charcater >> content ? >> >> Werner >> > >> > >> > --- 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 >> > >> > >> >> --------------------------------------------------------------------- >> 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 > > > > -- View this message in context: http://www.nabble.com/%22inject%22-custom-XML-in-a-generated-XML-tp22165190p24827981.html Sent from the Castor - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

