title: How to Convert Java Object to XML object with java keyword
body: <p>I create an java class:</p>
  
  <pre><code>public class ReturnObj {
  
      private String returncode;
      private String returndesc;
      private Pkg pkg;
      public String getReturncode() {
          return returncode;
      }
  
      public void setReturncode(String returncode) {
          this.returncode = returncode;
      }
  
      public String getReturndesc() {
          return returndesc;
      }
  
      public void setReturndesc(String returndesc) {
          this.returndesc = returndesc;
      }
  
  }
  </code></pre>
  
  <p>and other class:</p>
  
  <pre><code>public class Pkg {
  
      private String packagecode;
      private String cycle;
      private String price;
      private String desc;
      public String getPackagecode() {
          return packagecode;
      }
  
      public void setPackagecode(String packagecode) {
          this.packagecode = packagecode;
      }
  
      public String getCycle() {
          return cycle;
      }
  
      public void setCycle(String cycle) {
          this.cycle = cycle;
      }
  
      public String getPrice() {
          return price;
      }
  
      public void setPrice(String price) {
          this.price = price;
      }
  
      public String getDesc() {
          return desc;
      }
  
      public void setDesc(String desc) {
          this.desc = desc;
      }
  }
  </code></pre>
  
  <p>And I Want to convert object ReturnObj to this XML</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;return&gt;
      &lt;returncode&gt;1&lt;/returncode&gt;
      &lt;returndesc&gt;DANG_KY_THANH_CONG&lt;/returndesc&gt;
      &lt;package&gt;
          &lt;packagecode&gt;BD30&lt;/packagecode&gt;
          &lt;cycle&gt;1&lt;/cycle&gt;
          &lt;price&gt;15000&lt;/price&gt;
          &lt;desc&gt; BD30&lt;/desc&gt;
      &lt;/package&gt;
  &lt;/return&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>So how do I serialize an attribute pkg to package in XML? Because Java doesn't allow to name variable as an keyword anh package is an keyword in Java !</p>