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); }
public void loadSocialsElement(IXMLElement xml) throws Exception { String src = xml.getAttribute(PROPERTY_SRC, null); // If the passed xml element just points to a file if (src != null) { IXMLParser xmp = new StdXMLParser(); xmp.setBuilder(new StdXMLBuilder()); xmp.setValidator(new NonValidator()); xmp.setReader(StdXMLReader.fileReader(src)); xml = (XMLElement) xmp.parse(); xmp = null; } int count = 0; for (Enumeration enu = xml.getChildrenNamed(Social.MARKUP).elements(); enu.hasMoreElements(); count++) { IXMLElement nxt = (IXMLElement) enu.nextElement(); this.socials.addCommand(Social.loadSocial(nxt)); } }