0

Please can someone help me create XML using JAXB. I want to create structure like this one but I don“t know how to to do it :(

this has to be in loop
<param name="ContentRouter.NumberReplacements">
  <value xsi:type="ContentRouter:ReplacementRuleList">
    <item>
      <pattern>mmmmmmm</pattern>
      <numberPattern>nnnnnnnnn</numberPattern>
      <replace>oooooo</replace>
    </item>
    <item>
      <pattern>aaaaaaaaa</pattern>
      <numberPattern>bbbbbbbb</numberPattern>
      <replace>ccccccc</replace>
    </item>
  </value>
</param>

 it has to iterate in loop also
 <item>
   <pattern>ddddd</pattern>
      <routes>
        <item>
          <routingMode>eeeeeeee</routingMode>
          <value>fffff</value>
        </item>
      </routes>
    </item>
  </value>
</param>

or please can you send me some good tutorial. Thanks

user3318485
  • 13
  • 1
  • 5

1 Answers1

0

You Need a Class with @RootElement(name="param"), with a Child class with @RootElement(name="value") and a Child class with @RootElement(name="item") with the @XmlElement(name="...").

If you got more than 1 Elements with the Same Element Name, just return a List in the getter Method declared with the @XmlElement Tag.

Just watch some JAXB Tutorials on YouTube and try them at some examples.

Found this at YouTube in 2 Sec: https://www.youtube.com/watch?v=Ip0T91q70PA

Arol
  • 62
  • 7