/** * Create an output Writer based on the OutputStream using the * encoding (use "UTF-8" if encoding == null), then write the DOM * graph out. */ public void write(OutputStream os, String encoding, Document document) throws java.io.IOException { if (encoding == null) encoding = "UTF-8"; out = new BufferedWriter(new OutputStreamWriter(os, encoding)); write(document, encoding); }
/** * Same as write(OutputStream os, Document document) * where os = the file's OutputStream. */ public void write(File f, Document document) throws java.io.IOException { OutputStream fout = new FileOutputStream(f); try { write(fout, document); } finally { fout.close(); } }
protected void write(String docName, String publicId, String systemId, NamedNodeMap entities) throws java.io.IOException { out.write("<!DOCTYPE "+docName); // NOI18N if (publicId != null) { out.write(" PUBLIC \""); // NOI18N XMLUtil.printXML(out, publicId); out.write("\""); // NOI18N if (systemId == null) systemId = "SYSTEM"; // NOI18N } if (systemId != null) { out.write(" \""); // NOI18N XMLUtil.printXML(out, systemId); out.write("\""); // NOI18N } if (entities != null) { int length = entities.getLength(); if (length > 0) { out.write(" ["); // NOI18N for (int i = 0; i < length; ++i) { Node node = entities.item(i); write(node); } out.write("]"); // NOI18N } } out.write(">"); // NOI18N }
if (node instanceof Element) { out.write("<"+node.getNodeName()); write(node.getAttributes()); if (children.getLength() == 0 || (children.getLength() == 1 && needsReturnBetweenChildren = true; } else if (node instanceof DocumentType) { write((DocumentType) node); } else if (node instanceof Comment) { write((Comment) node); } else if (node instanceof Entity) { write((Entity) node); } else if (node instanceof ProcessingInstruction) { write((ProcessingInstruction) node); } else { System.err.println("! schema2beans found unknown node type in DOM graph:"); write(children.item(i)); if (needsReturnBetweenChildren) out.write("\n");
if (docType != null) entities = docType.getEntities(); write(docName, docTypePublic, docTypeSystem, entities); out.write("\n"); Node node = children.item(i); if (node instanceof DocumentType) { write(node); out.write("\n"); Node node = children.item(i); if (!(node instanceof DocumentType)) { write(node); out.write("\n");
/** * OutputStream version of write() */ void write(OutputStream out) throws IOException, Schema2BeansException { // // Code specific to the DOM implementation: // if (this.document == null) throw new Schema2BeansException(Common.getMessage("CantGetDocument_msg")); if (this.docWriter != null) this.docWriter.write(out, this.document); else { XMLUtil.DOMWriter domWriter = getDOMWriter(); domWriter.write(out, document); } }
protected void write(OutputStream out, String encoding) throws java.io.IOException { XMLUtil.DOMWriter domWriter = getDOMWriter(); domWriter.write(out, encoding, document); }
protected void write(DocumentType docType) throws java.io.IOException { //System.out.println("! FOUND DOCTYPE for "+docType.getName()); if (docTypePublic != null || docTypeSystem != null) { // The header printing has already taken care of the DOCTYPE. return; } write(docType.getName(), docType.getPublicId(), docType.getSystemId(), docType.getEntities()); }
/** * Assumes that the output Writer has already been set. * @param encoding goes into the XML header. */ public void write(Document document, String encoding) throws java.io.IOException { write(document, encoding, true); }
protected void write(java.io.Writer out, String encoding) throws java.io.IOException { XMLUtil.DOMWriter domWriter = getDOMWriter(); domWriter.setWriter(out); domWriter.write(document, encoding); }
/** * Same as write(OutputStream os, String encoding, Document document) * where encoding == null. */ public void write(OutputStream os, Document document) throws java.io.IOException { write(os, null, document); }
protected void write(java.io.Writer out) throws java.io.IOException { XMLUtil.DOMWriter domWriter = getDOMWriter(); domWriter.setWriter(out); domWriter.write(document); }
/** * Assumes that the output Writer has already been set. */ public void write(Document document) throws java.io.IOException { write(document, null); }
public void write(java.io.Writer out, Node node) throws java.io.IOException, Schema2BeansException { XMLUtil.DOMWriter domWriter = getDOMWriter(); domWriter.setWriter(out); domWriter.write(node); }