Diogo,
Yes you can use that method as well...actually if you look at the
Javadoc you'll see that it states the following:
* This method is basically the same as calling
* #setMarshalAsDocument(false);
Basically #setSupressXMLDeclaration was added long after the
#setMarshalAsDocument method. I got tired of answering so many questions
on how to prevent the XML declaration from being output, because many
people were overlooking the #setMarshalAsDocument method (probably due
to it's non-intuitive name). So I added the method to make it more
intuitive and left the old method in place for backward compatibility.
Anyway, setSupressXMLDeclaration simply delegates to
setMarshalAsDocument under the hood, so you can use either method.
--Keith
Diogo Quintela (EF) wrote:
marshaller.setSupressXMLDeclaration(true);
Isn't this for that? To prevent castor to output xml declaration ?
I've used it with success.
Diogo
-----------------------------------
Diogo Bacelar Quintela
EF - Tecnologias de Informação, Lda.
Av. António Serpa, 26 - 4º Dto.
1050-027 Lisboa, Portugal
Tel: (+351) 217 827 800
Fax: (+351) 217 827 830
Email: [EMAIL PROTECTED]
PGP: 0xF51A5AB9
-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED]
Sent: quinta-feira, 10 de Novembro de 2005 4:34
To: [email protected]
Subject: Re: [castor-user] How to add comment in XML output ?
Stephane,
You could do the following:
writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
writer.write("<!--WARNING: Do NOT edit ... by Castor. -->\n");
marshaller.setMarshalAsDocument(false);
marshaller.marshal(myObject);
The important step being the marshaller.setMarshalAsDocument(false)
which will prevent Castor from outputting the xml declaration.
--Keith
Bedin, Stephane (GE Healthcare) wrote:
Hi,
Is there a way with castor
when marshalling an object, to add an XML comment to the generated
document ?
I expect the XML document to looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!--WARNING: Do NOT edit this file. It was produced automatically by
Castor. -->
<MaClass>
...
</MyClass>
Stéphane
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------