登 录
out.println("<?xml version=/"1.0/" encoding=/"GBK/"?>"); print(((Document)node).getDocumentElement()); out.flush(); break; case Node.ELEMENT_NODE: out.print('<'); out.print(node.getNodeName()); NamedNodeMap attrs = node.getAttributes(); for ( int i = 0; i < attrs.getLength(); i++ ) { out.print(' '); out.print(attrs.item(i).getNodeName()); out.print("=/""); out.print(attrs.item(i).getNodeValue()); out.print('"'); } out.print('>'); out.println(); // HACK NodeList children = node.getChildNodes(); if ( children != null ) { int len = children.getLength(); for ( int i = 0; i < len; i++ ) { print(children.item(i)); } } break; case Node.TEXT_NODE: out.print(node.getNodeValue()); break; } if ( type == Node.ELEMENT_NODE ) { out.print("</"); out.print(node.getNodeName()); out.print('>'); out.println(); // HACK } out.flush(); } public static void main(String args[]) { String conf="D:/tidy.properties"; FileInputStream in;
Tidy tidy = new Tidy(); tidy.setConfigurationFromFile(conf); TestDOM t = new TestDOM(); try { in = new FileInputStream("D:/speed.html"); tidy.setMakeClean(true); tidy.setXmlTags(true); t.print(tidy.parseDOM(in, null)); } catch ( IOException e ) { System.err.println( e.toString() ); } } }
tidy.parse(in, out); } catch (IOException e) { System.out.println(this.toString() + e.toString()); } } public static void main(String[] args) { String src="D:/speed.html"; String out="D:/result.xml"; String err="D:/err.txt"; String conf="D:/tidy.properties"; Test17 t1 = new Test17(src,out,conf); Thread th1 = new Thread(t1); th1.start(); } }
抱歉!评论已关闭.