private static XMLSerializer getXMLSerializer(final OutputStream os, final String[] cdataElements) throws InstantiationException, IllegalAccessException, ClassNotFoundException { // configure an OutputFormat to handle CDATA final OutputFormat of = new OutputFormat(); // specify which of your elements you want to be handled as CDATA. // The use of the '^' between the namespaceURI and the localname // seems to be an implementation detail of the xerces code. // When processing xml that doesn't use namespaces, simply omit the // namespace prefix as shown in the third CDataElement below. of.setCDataElements(cdataElements); // set any other options you'd like of.setPreserveSpace(true); of.setIndenting(true); // create the serializer final XMLSerializer serializer = new XMLSerializer(of); serializer.setOutputByteStream(os); return serializer; }
format.setPreserveSpace(true); format.setIndenting(true); StringWriter w = new StringWriter();
outputFormat.setPreserveSpace(false);
private static OutputFormat getXmlNoSpace(String encoding) { OutputFormat fmt = new OutputFormat("XML", encoding, false); // indent == 0 means add no indenting fmt.setIndent(0); // default line width is 72, but only applies when indenting fmt.setLineWidth(0); fmt.setPreserveSpace(false); return fmt; }
private static OutputFormat getXmlNoSpace(String encoding) { OutputFormat fmt = new OutputFormat("XML", encoding, false); // indent == 0 means add no indenting fmt.setIndent(0); // default line width is 72, but only applies when indenting fmt.setLineWidth(0); fmt.setPreserveSpace(false); return fmt; }
true); format.setOmitXMLDeclaration(false); format.setPreserveSpace(false); XMLSerializer serializer = new XMLSerializer(out, format); try {
protected synchronized void saveDeadProperties() { if (deadpropmodified) { ArrayDictionary dic = new ArrayDictionary(deadindex.size()); Enumeration denum = deadindex.keys(); while (denum.hasMoreElements()) { String ns = (String)denum.nextElement(); Document doc = (Document)deadindex.get(ns); ByteArrayOutputStream out = new ByteArrayOutputStream(); OutputFormat format = new OutputFormat(doc, WEBDAV.ENCODING, true); format.setOmitXMLDeclaration(false); format.setPreserveSpace(true); XMLSerializer serializer = new XMLSerializer(out, format); try { serializer.serialize(doc); if (debug) System.out.println("["+out.toString(WEBDAV.ENCODING) +"]"); Base64Encoder encoder = new Base64Encoder(out.toString(WEBDAV.ENCODING)); dic.put(ns, encoder.processString()); } catch (IOException ex) { ex.printStackTrace(); } } setValue(ATTR_DEAD_PROPERTIES, dic); deadpropmodified = false; } }
true); format.setOmitXMLDeclaration(false); format.setPreserveSpace(false); XMLSerializer serializer = new XMLSerializer(out, format); try {
private synchronized void saveLockOwner() { if (ownerNode != null) { Document doc = DAVBody.createDocument(DAVNode.OWNER_NODE); DAVNode.exportChildren(doc, doc.getDocumentElement(), ownerNode, true); ByteArrayOutputStream out = new ByteArrayOutputStream(); OutputFormat format = new OutputFormat(doc, WEBDAV.ENCODING, true); format.setOmitXMLDeclaration(false); format.setPreserveSpace(true); XMLSerializer serializer = new XMLSerializer(out, format); try { serializer.serialize(doc); if (debug) System.out.println("["+out.toString(WEBDAV.ENCODING)+"]"); Base64Encoder encoder = new Base64Encoder(out.toString(WEBDAV.ENCODING)); setValue(ATTR_LOCK_OWNER, encoder.processString()); } catch (IOException ex) { ex.printStackTrace(); } } }
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 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 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 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; }
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 XMLSerializer getXMLSerializer( OutputStream os, String[] cdataElements ) throws InstantiationException, IllegalAccessException, ClassNotFoundException { // configure an OutputFormat to handle CDATA OutputFormat of = new OutputFormat(); // specify which of your elements you want to be handled as CDATA. // The use of the '^' between the namespaceURI and the localname // seems to be an implementation detail of the xerces code. // When processing xml that doesn't use namespaces, simply omit the // namespace prefix as shown in the third CDataElement below. of.setCDataElements( cdataElements ); // set any other options you'd like of.setPreserveSpace(true); of.setIndenting(true); // create the serializer XMLSerializer serializer = new XMLSerializer(of); serializer.setOutputByteStream( os ); return serializer; }
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); }