private byte[] addXMLNameSpace(Document xmlDoc, String nameSpace){ Node node = xmlDoc.getDocumentElement(); Element element = (Element)node; element.setAttribute("xmlns", nameSpace); OutputFormat outputFormat = new OutputFormat(xmlDoc); outputFormat.setOmitDocumentType(true); ByteArrayOutputStream out = new ByteArrayOutputStream(); XMLSerializer serializer = new XMLSerializer( out,outputFormat ); try { serializer.asDOMSerializer(); serializer.serialize( xmlDoc.getDocumentElement()); } catch (IOException e) { throw new RuntimeException(e); } return out.toByteArray(); } }
outputFormat.setOmitDocumentType(true);
@Deprecated private static OutputFormat getOutputFormat(boolean omitXMLDeclaration, boolean omitDocumentType) { OutputFormat format = new OutputFormat(Method.XML, "UTF-8", true); format.setIndent(2); format.setLineWidth(80); if (omitXMLDeclaration) { format.setOmitXMLDeclaration(true); } if (omitDocumentType) { format.setOmitDocumentType(true); } return format; }
@Deprecated private static OutputFormat getOutputFormat(boolean omitXMLDeclaration, boolean omitDocumentType) { OutputFormat format = new OutputFormat(Method.XML, "UTF-8", true); format.setIndent(2); format.setLineWidth(80); if (omitXMLDeclaration) { format.setOmitXMLDeclaration(true); } if (omitDocumentType) { format.setOmitDocumentType(true); } return format; }
private static OutputFormat getConsoleNoDocType() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(80); fmt.setPreserveSpace(false); // default is false fmt.setOmitXMLDeclaration(false); fmt.setOmitDocumentType(true); return fmt; }
public static ContentHandler getXercesSerializer(OutputStream os) { XMLSerializer serializer = new XMLSerializer(); OutputFormat format = new OutputFormat(); format.setPreserveSpace(true); format.setOmitDocumentType(true); serializer.setOutputFormat(format); serializer.setOutputByteStream(os); return serializer; } }
private static OutputFormat getMgmtWithDecl() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(120); fmt.setPreserveSpace(false); fmt.setOmitXMLDeclaration(false); fmt.setOmitDocumentType(true); return fmt; }
private static OutputFormat getConsoleWithDocType() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(80); fmt.setPreserveSpace(false); // default is false fmt.setOmitXMLDeclaration(false); // default is false fmt.setOmitDocumentType(false); return fmt; }
private static OutputFormat getConsoleWithDocType() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(80); fmt.setPreserveSpace(false); // default is false fmt.setOmitXMLDeclaration(false); // default is false fmt.setOmitDocumentType(false); return fmt; }
private static OutputFormat getMgmtNoDecl() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(120); fmt.setPreserveSpace(false); fmt.setOmitXMLDeclaration(true); fmt.setOmitDocumentType(true); return fmt; }
private static OutputFormat getMgmtWithDecl() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(120); fmt.setPreserveSpace(false); fmt.setOmitXMLDeclaration(false); fmt.setOmitDocumentType(true); return fmt; }
private static OutputFormat getMgmtNoDecl() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(120); fmt.setPreserveSpace(false); fmt.setOmitXMLDeclaration(true); fmt.setOmitDocumentType(true); return fmt; }
private static OutputFormat getConsoleNoDocType() { OutputFormat fmt = new OutputFormat("XML", "UTF-8", true); fmt.setIndent(2); fmt.setLineWidth(80); fmt.setPreserveSpace(false); // default is false fmt.setOmitXMLDeclaration(false); fmt.setOmitDocumentType(true); return fmt; }
format.setOmitDocumentType( "true".equals(policy.getDirective(Policy.OMIT_DOCTYPE_DECLARATION)) );
public SerializingUserLayoutDao() { layoutOutputFormat=new OutputFormat(); layoutOutputFormat.setIndenting(true); layoutOutputFormat.setLineWidth(0); layoutOutputFormat.setOmitDocumentType(false); layoutOutputFormat.setPreserveSpace(true); layoutOutputFormat.setEncoding("UTF-8"); layoutOutputFormat.setOmitComments(false); layoutOutputFormat.setOmitXMLDeclaration(false); layoutOutputFormat.setDoctype(publicDoctype, systemDoctype); }