public static void main(String[] arguments) {
		if (arguments.length<1) {
			log("Usage: AXMLPrinter <binary xml file>");
			return;
		}
		try {
			AXMLParser parser=new AXMLParser(new FileInputStream(arguments[0]));
			StringBuilder indent=new StringBuilder(10);
			final String indentStep="    ";
			while (true) {
				int type=parser.next();
				if (type==XmlPullParser.END_DOCUMENT) {
					break;
				}
				switch (type) {
					case XmlPullParser.START_DOCUMENT:
					{
						break;
					}
					case XmlPullParser.START_TAG:
					{
						log("%s<%s",indent,parser.getName());
						indent.append(indentStep);
						for (int i=0;i!=parser.getAttributeCount();++i) {
							log("%s%s%s=%s",
								indent,
								makeNamespacePrefix(parser.getAttributeNamespace(i)),
								parser.getAttributeName(i),
								makeAttributeValue(parser,i));
						}
						log("%s>",indent);
						break;
					}
					case XmlPullParser.END_TAG:
					{
						indent.setLength(indent.length()-indentStep.length());
						log("%s</%s>",indent,parser.getName());
						break;
					}
					case XmlPullParser.TEXT:
					{
						log("%s%s",indent,parser.getName());
						break;
					}
				}
			}
		}
		catch (IOException e) {
			e.printStackTrace();
		}
	}