java - JAXB Marshaller creates unexpected tags -
i have 2 classes called releasedata , issuedata need converted xml. use annotations tell how conversion must done.
the releasedata has following parameters:
@xmlelement( name = "version", required = true ) private string m_version; @xmlelement( name = "product", required = true ) private string m_product; @xmlelement( name = "releasedate", required = true ) private string m_releasedate; @xmlelement( name = "components", required = true ) private string m_components; @xmlelement( name = "issue", required = true ) private list<issuedata> m_issues; @xmlelement( name = "freetext", required = false ) private string m_freetext;
the parameters issuedata following
@xmltransient private string m_key; @xmlelement( name = "summary", required = true ) private string m_summary; @xmlelement( name = "key", required = true ) private string m_ep; @xmlelement( name = "releasenote", required = true ) private string m_releasenote; @xmltransient private list<string> m_components; @xmlelement( name = "component", required = true ) private string m_componentliststring; @xmltransient private issue m_issue; @xmltransient private string m_status; @xmltransient private string m_resolution;
when marshal releasedata
file file = new file( xmldatapath ); jaxbcontext jaxbcontext = jaxbcontext.newinstance( releasedata.class ); marshaller jaxbmarshaller = jaxbcontext.createmarshaller(); jaxbmarshaller.setproperty( marshaller.jaxb_formatted_output, true ); jaxbmarshaller.marshal( releasedata, file );
the resulting xml looks expected accept 1 set of tags. resulting xml looks below:
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <releasedata> <version>07.01.08.00</version> <product>myproduct</product> <releasedate>11 november 2016</releasedate> <components>component1, component2</components> <issue> <summary>my first summary</summary> <key>key-1</key> <releasenote>my first release note</releasenote> <component>component1</component> </issue> <issue> <summary>my second summary</summary> <key>key-2</key> <releasenote>my second release note</releasenote> <component>component2</component> </issue> <freetext>this free text</freetext> <issues> <summary>my first summary</summary> <key>key-1/key> <releasenote>my first release note</releasenote> <component>component1</component> </issues> <issues> <summary>my second summary</summary> <key>key-2</key> <releasenote>my second release note</releasenote> <component>component2</component> </issues> </releasedata>
my question is: second set of tags come from? can't find other code or class in application has (xml) annotations
Comments
Post a Comment