public static void main(String args[]) throws Exception { if (args.length == 0) { System.err.println("Usage: java DumpXML file.xml"); Runtime.getRuntime().exit(1); } IXMLParser parser = XMLParserFactory.createDefaultXMLParser(); IXMLReader reader = StdXMLReader.fileReader(args[0]); parser.setReader(reader); XMLElement xml = (XMLElement) parser.parse(); Properties prop = xml.getAttributes(); prop.list(System.out); }
public static void main(String args[]) throws Exception { if (args.length == 0) { System.err.println("Usage: java DumpXML file.xml"); Runtime.getRuntime().exit(1); } IXMLParser parser = XMLParserFactory.createDefaultXMLParser(); IXMLReader reader = StdXMLReader.fileReader(args[0]); parser.setReader(reader); XMLElement xml = (XMLElement) parser.parse(); xml.addChild(null); (new XMLWriter(System.out)).write(xml); }