简单写了个,直接将你的XML解析后再重新输出
Java code
private void parseUsingkXML(InputStream is) throws XmlPullParserException {
        try {
            KXmlParser parser = new KXmlParser();// 实例化
            parser.setInput(is, "utf-8");
            parsekXMLItems(parser);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    private void parsekXMLItems(KXmlParser parser) throws IOException,
            XmlPullParserException {
        // 接收事件类型
        int eventType = parser.getEventType();
        // 当事件类型不为文档末尾时
        while (eventType != XmlPullParser.END_DOCUMENT) { // true
            // System.out.println("parsekXMLItems");
            switch (eventType) {// 判断事件类型
            case XmlPullParser.START_TAG:// 为开始标记时
                System.out.print("<" + parser.getName());// 输出开始标记
                // 当有属性时,输出属性
                if (parser.getAttributeCount() >= 1)
                    for (int i = 0; i < parser.getAttributeCount(); i++) {
                        // 输出属性名称
                        System.out
                                .print(" " + parser.getAttributeName(i) + "=");
                        // 输出属性值
                        System.out.print("\"" + parser.getAttributeValue(i)
                                + "\"");
                    }
                System.out.print(">");
                break;
            case XmlPullParser.END_TAG:// 为结束标记时
                System.out.print("</" + parser.getName() + ">");
                break;
            case XmlPullParser.TEXT:// 为文档正文时
                // if (!parser.getText().trim().equals("")) {
                System.out.print(parser.getText());
                // }
                break;
            case XmlPullParser.END_DOCUMENT:
                return;
            }
            eventType = parser.next();
        }
        System.out.println();
    }<WuDang>    <person>    <uname>风清杨 </uname>    <attack>独孤九剑 </attack>    </person>    <person>    <uname>岳不群 </uname>    <attack>紫霞神功 </attack>    </person>  </WuDang>