public static void print( Node node ) { print( node, System.out ); }
print( ( (Document) node ).getDocumentElement() ); for ( int i = 0; i < len; i++ ) { Attr attr = (Attr) attrs.item( i ); out.print( " " + attr.getNodeName() + "=\"" + escapeXML( attr.getNodeValue() ) + "\"" ); print( children.item( 0 ), out, "" ); out.print( "</" + node.getNodeName() + ">\n" ); print( children.item( i ), out, indent + " " ); out.print( escapeXML( node.getNodeValue() ) ); break;
write( ( (Document) node ).getDocumentElement(), out, indent ); break; for ( int i = 0; i < len; i++ ) { Attr attr = (Attr) attrs.item( i ); out.write( " " + attr.getNodeName() + "=\"" + escapeXML( attr.getNodeValue() ) + "\"" ); write( children.item( 0 ), out, "" ); out.write( "</" + node.getNodeName() + ">\n" ); write( children.item( i ), out, indent + " " ); out.write( escapeXML( node.getNodeValue() ) ); break;
/** * @param root * @param file */ public static void write( Element root, File file ) throws IOException { System.out.print( "\nWriting DOM to " + file.getAbsolutePath() + " ... " ); System.out.flush(); // prepare a file writer. Writer writer = new BufferedWriter( new FileWriter( file ) ); // Write the content in the file (indented !!) DisplayXML.write( root, writer, " " ); writer.flush(); // Close the file writer.close(); System.out.println( "done." ); }
print( ( (Document) node ).getDocumentElement() ); for ( int i = 0; i < len; i++ ) { Attr attr = (Attr) attrs.item( i ); out.print( " " + attr.getNodeName() + "=\"" + escapeXML( attr.getNodeValue() ) + "\"" ); print( children.item( 0 ), out, "" ); out.print( "</" + node.getNodeName() + ">\n" ); print( children.item( i ), out, indent + " " ); out.print( escapeXML( node.getNodeValue() ) ); break;
write( ( (Document) node ).getDocumentElement(), out, indent ); break; for ( int i = 0; i < len; i++ ) { Attr attr = (Attr) attrs.item( i ); out.write( " " + attr.getNodeName() + "=\"" + escapeXML( attr.getNodeValue() ) + "\"" ); write( children.item( 0 ), out, "" ); out.write( "</" + node.getNodeName() + ">\n" ); write( children.item( i ), out, indent + " " ); out.write( escapeXML( node.getNodeValue() ) ); break;
/** * @param root * @param file */ public static void write( Element root, File file ) throws IOException { System.out.print( "\nWriting DOM to " + file.getAbsolutePath() + " ... " ); System.out.flush(); // prepare a file writer. Writer writer = new BufferedWriter( new FileWriter( file ) ); // Write the content in the file (indented !!) DisplayXML.write( root, writer, " " ); writer.flush(); // Close the file writer.close(); System.out.println( "done." ); }
public static void print( Node node ) { print( node, System.out ); }
print( ( (Document) node ).getDocumentElement() ); for ( int i = 0; i < len; i++ ) { Attr attr = (Attr) attrs.item( i ); out.print( " " + attr.getNodeName() + "=\"" + escapeXML( attr.getNodeValue() ) + "\"" ); print( children.item( 0 ), out, "" ); out.print( "</" + node.getNodeName() + ">\n" ); print( children.item( i ), out, indent + " " ); out.print( escapeXML( node.getNodeValue() ) ); break;
write( ( (Document) node ).getDocumentElement(), out, indent ); break; for ( int i = 0; i < len; i++ ) { Attr attr = (Attr) attrs.item( i ); out.write( " " + attr.getNodeName() + "=\"" + escapeXML( attr.getNodeValue() ) + "\"" ); write( children.item( 0 ), out, "" ); out.write( "</" + node.getNodeName() + ">\n" ); write( children.item( i ), out, indent + " " ); out.write( escapeXML( node.getNodeValue() ) ); break;
/** * @param root * @param file */ public static void write( Element root, File file ) throws IOException { System.out.print( "\nWriting DOM to " + file.getAbsolutePath() + " ... " ); System.out.flush(); // prepare a file writer. Writer writer = new BufferedWriter( new FileWriter( file ) ); // Write the content in the file (indented !!) DisplayXML.write( root, writer, " " ); writer.flush(); // Close the file writer.close(); System.out.println( "done." ); }
public static void print( Node node, PrintStream out ) { print( node, out, "" ); }
/** * Write an Element (supposingly the root of a document) into a file. * * @param root the root of the XML Document. * @param file the file in which we are supposed to write the content. * * @throws IOException if an error occur while writting. */ private static void write( Element root, File file ) throws IOException { System.out.print( "\nWriting DOM to " + file.getAbsolutePath() + " ... " ); System.out.flush(); // prepare a file writer. Writer writer = new BufferedWriter( new FileWriter( file ) ); // Write the content in the file (indented !!) DisplayXML.write( root, writer, " " ); writer.flush(); // Close the file writer.close(); System.out.println( "done." ); }
public static void print( Node node, PrintStream out ) { print( node, out, "" ); }
/** * Write an Element (supposingly the root of a document) into a file. * * @param root the root of the XML Document. * @param file the file in which we are supposed to write the content. * * @throws IOException if an error occur while writting. */ private static void write( Element root, File file ) throws IOException { System.out.print( "\nWriting DOM to " + file.getAbsolutePath() + " ... " ); System.out.flush(); // prepare a file writer. Writer writer = new BufferedWriter( new FileWriter( file ) ); // Write the content in the file (indented !!) DisplayXML.write( root, writer, " " ); writer.flush(); // Close the file writer.close(); System.out.println( "done." ); }
public static void print( Node node, PrintStream out ) { print( node, out, "" ); }
/** * Write an Element (supposingly the root of a document) into a file. * * @param root the root of the XML Document. * @param file the file in which we are supposed to write the content. * * @throws IOException if an error occur while writting. */ private static void write( Element root, File file ) throws IOException { System.out.print( "\nWriting DOM to " + file.getAbsolutePath() + " ... " ); System.out.flush(); // prepare a file writer. Writer writer = new BufferedWriter( new FileWriter( file ) ); // Write the content in the file (indented !!) DisplayXML.write( root, writer, " " ); writer.flush(); // Close the file writer.close(); System.out.println( "done." ); }
public static void print( Node node ) { print( node, System.out ); }
private static PsiValidatorReport writeFile(Document doc, File xmlFile, boolean validate) throws IOException { // create the parent dir if it does not exist if (!xmlFile.getParentFile().exists()) { log.info("Creating dir: "+xmlFile.getParentFile()); xmlFile.getParentFile().mkdirs(); } Writer writer = new FileWriter(xmlFile); DisplayXML.write(doc, writer, " "); writer.close(); if (validate) { return PsiValidator.validate(xmlFile); } return new PsiValidatorReport(); }
public void printXmlContent() { if ( node != null ) { DisplayXML.print( node, System.out ); } else { System.out.println( "No XML content stored in that message." ); } }