dom4j

Element iq = packet.getElement();
		Element b = iq.element("message");

		for (Iterator ia = b.attributeIterator(); ia.hasNext();) {
			Attribute attribute = (Attribute) ia.next();
			System.out.println(attribute.getName() + ":" + attribute.getData());
		}
		IQ reply = IQ.createResultIQ(packet);
		JID sender = packet.getFrom();
		Element xx = packet.getChildElement();
		for (Iterator ieson = b.elementIterator(); ieson.hasNext();) {
			Element elementSon = (Element) ieson.next();
			System.out.println(elementSon.getName() + ":"
					+ elementSon.getText());
		}
		System.out.println(b.attributeValue("to"));

你可能感兴趣的:(dom4j)