Q:

RDF+XML response - xml version tag is missing

I've a sevlet in Java which create a RDF/XML-ABBREV model. My problem is that the response doesn't contain the xml version tag.
Current response:
<rdf:RDF
    xmlns:myNS="http://www.sap.de/research/BusinessObjectOntology#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
  <myNS:Resource rdf:about="http://localhost/myResource">
    ...
  </myNS:Resource>
</rdf:RDF>

but I need the <?xml version="1.0"?> at the beginning of my model.
Do I have to add something to my code or why does the xml version tag not show up?
resp.setCharacterEncoding(CHARSET);
resp.setContentType("application/rdf+xml");
resp.setStatus(HttpStatus.OK_200);
model.write(resp.getWriter(), "RDF/XML-ABBREV");

thanks

A:

The declaration is optional, but you can require it.
According to the XML writer documentation:

The default behaviour only gives an XML Declaration when asked to write to an OutputStreamWriter that uses some encoding other than UTF-8 or UTF-16.

To customise the output try:
...
RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
writer.setProperty("showXmlDeclaration","true");
writer.write(model, resp.getWriter(), null);

