java - JAXB EclipseLink Moxy add template xml -
i have problem jaxb eclipselink implementation.
let's assume have following entity ...
@xmlrootelement(name = genericconfigentity.xml_root_tag) public class genericconfigentity { private string name; private string data; private string version; private string date; private string template; @xmlattribute(name = genericconfigentity.xml_name) public string getname() { return name; } public void setname(string name) { this.name = name; } @xmlelement(name = genericconfigentity.xml_data) public string getdata() { return data; } public void setdata(string data) { this.data = data; } @xmlattribute(name = genericconfigentity.xml_version) public string getversion() { return version; } public void setversion(string version) { this.version = version; } @xmlattribute(name = genericconfigentity.xml_date) public string getdate() { return date; } public string gettemplate() { return template; } public void settemplate(string template) { this.template = template; } }
the string 'template' contains xml data let's someting (in real context lot more , not want create entities this).
<prozess name="xx" test="1"> <debug system="test" /> </prozess>
now question if there way integrate template string marshalling process someting generated
<conf name="xx" version="x" datum="xx"> <prozess name="xx" test="1"> <debug system="test" /> </prozess> <data> texttexttext </data> </conf>
it no solution wrap template in tag because restricted layout.
also @xmlvalue no solution because exception "all other elements have attribute because 1 marked xmlvalue".
i haven't used myself yet, reckon use @xmlanyelement
in conjunction domhandler
implement such mapping. can find helpful example in blog of moxy's lead programmer here.
i think you'd still have make sure xml content in template field has @ least opening , closing tag, serve identify dom element during (un)marshalling. tag may arbitrary required you. guess first tag appearing in string , try match against end of string.
Comments
Post a Comment