[xstream-user] StaxDriver and XStream

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xstream-user] StaxDriver and XStream

RoshanP
I was modifying the test in the XStream code:
com.thoughtworks.xstream.io.xml.StaxWriter2Test.java
to have a QNameMap for the
inner object Y. However, when the StaxDriver does
not marshal the innerObj to
have the QNameMap for the Y class.
It keeps the old <innerObj> tag.

Basically, I am trying to get this code to work:

QNameMap qnameMap = new QNameMap();
QName qname = new QName("http://foo.com", "alias", "foo");
qnameMap.registerMapping(qname, X.class);
qnameMap.registerMapping(new QName("http://foo.com", "aliasY", "foo"), Y.class);

String expected = XML_HEADER + "<foo:alias
 xmlns:foo=\"http://foo.com\"><aStr>zzz</aStr><anInt>9</anInt><foo:aliasY
xmlns:foo=\"http://foo.com\"><yField>ooo</yField></foo:aliasY></foo:alias>";