users@jaxb.java.net

unexpected results when marshalling

From: Tommy Berglund <tommy.berglund_at_pipebeach.com>
Date: Wed, 28 May 2003 13:09:22 +0200

Hello,

I have a problem when marshalling objects in my application. To easily
show you I have modified SampleApp1 slightly so it can print objects to
System.out like this:

...
Items items = po.getItems();
// m is defined as static Marshaller m;
m.marshal( items, System.out );
...
    
when I run the application I get the following output:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<item partNum="242-NO"><productName>Nosferatu - Special Edition
(1929)</productName><quantity>5</quantity><USPrice>19.99</USPrice></item
>
<item partNum="242-MU"><productName>The Mummy
(1959)</productName><quantity>3</quantity><USPrice>19.98</USPrice></item
>
<item partNum="242-GZ"><productName>Godzilla and Mothra: Battle for
Earth/Godzilla vs. King
Ghidora</productName><quantity>3</quantity><USPrice>27.95</USPrice></ite
m>

shouldn't it be:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<items>
<item partNum="242-NO"><productName>Nosferatu - Special Edition
(1929)</productName><quantity>5</quantity><USPrice>19.99</USPrice></item
>
<item partNum="242-MU"><productName>The Mummy
(1959)</productName><quantity>3</quantity><USPrice>19.98</USPrice></item
>
<item partNum="242-GZ"><productName>Godzilla and Mothra: Battle for
Earth/Godzilla vs. King
Ghidora</productName><quantity>3</quantity><USPrice>27.95</USPrice></ite
m>
</items>

why are the <items> and </items> elements excluded? is it possible to
get them included in the marshalled output?

/Tommy