0

by using normal xml am able to get standalone="yes" attribute with "xml" tag. But when I am trying to get like following by using CASTOR XML am unable. answer will be appreciate. Thanks in advance.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
SatishY
  • 69
  • 1
  • 4
  • 10

1 Answers1

0

Castor by default generate the XML declaration as follows

<?xml version="1.0" encoding="UTF-8" ?>

In my investigation I didn't get any castor mapping configuration to generate customized XML declaration. So, we can handle it as follows,

writer.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");

After appending our own XML declaration to writer, we need to suppress Castor not to generate the XML declaration.

marshaller.setSupressXMLDeclaration(true);
SatishY
  • 69
  • 1
  • 4
  • 10