XStream: how can I hide 2 unnecessary parent nodes in marshaled XML?

Viewed 954

In a unit test project, I need some help figuring out how how I can hide 2 unnecessary parent nodes in marshaled XML? Can anyone help me figure out how to do it?

My marshalled output looks like this:

<suite>
  <suiteName>Suite 1</suiteName>
  <sauceURL>http://username-string:access-key-string@ondemand.saucelabs.com:80/wd/hub</sauceURL>
  <tests>
    <test>
      <rowArgs>
        <arg>
          <enabled type="java.lang.Boolean">true</enabled>
        </arg>
        <arg>
          <testname type="java.lang.String">Test 1</testname>
        </arg>
        <arg>
          <environment type="java.lang.String">portal1</environment>
        </arg>
        <arg>
          <testlocale type="java.lang.String">Grid</testlocale>
        </arg>
        <arg>
          <browser type="java.lang.String">Firefox</browser>
        </arg>
        <arg>
          <url type="java.lang.String">http://google.com</url>
        </arg>
      </rowArgs>
    </test>
            ...

But I want to hide the unnecessary "rowArgs" and "arg" tag so that the the remaining nodes are immediately under the test node. How can I do this?

You can see my code HERE, if it helps you to help me. I suspect I need to write my own transformer? I'll work on that experiment in the meanwhile.

1 Answers
Related