/** * Sets the document type definition for the serializer. Note that this method cannot be called if * you've passed in your own DocumentHandler. * * @param publicId the public identifier * @param systemId the system identifier */ public void setDoctype(String publicId, String systemId) { if (_serializer != null) { if (_format == null) { _format = getInternalContext().getOutputFormat(); } _format.setDoctype(publicId, systemId); // -- reset output format, this needs to be done // -- any time a change occurs to the format. _serializer.setOutputFormat(_format); setDocumentHandler(); } else { String error = "doctype cannot be set if you've passed in " + "your own DocumentHandler"; throw new IllegalStateException(error); } } // -- setDoctype
_format = getInternalContext().getOutputFormat();
_format = getInternalContext().getOutputFormat();
_format = getInternalContext().getOutputFormat();
_format = getInternalContext().getOutputFormat();
/** * Sets whether or not to marshal as a document which includes the XML declaration, and if * necessary the DOCTYPE declaration. By default the Marshaller will marshal as a well formed XML * document including the XML Declaration. * * If the given boolean is false, the Marshaller will marshal as a well formed XML fragment (no * XML declaration or DOCTYPE). * * This method is basically the same as calling #setSupressXMLDeclaration(true); * * @param asDocument a boolean, when true, indicating to marshal as a complete XML document. * @see #setSupressXMLDeclaration */ public void setMarshalAsDocument(boolean asDocument) { _asDocument = asDocument; if (_serializer != null) { if (_format == null) { _format = getInternalContext().getOutputFormat(); } _format.setOmitXMLDeclaration(!asDocument); _format.setOmitDocumentType(!asDocument); // -- reset output format, this needs to be done // -- any time a change occurs to the format. _serializer.setOutputFormat(_format); setDocumentHandler(); } } // -- setMarshalAsDocument