提取xml中所有节点的text数据

Element e = doc.getRootElement();
Stack<Element> stack = new Stack<Element>();

			stack.push(e);
			while (!stack.isEmpty()) {
				Element node = stack.pop();
				if (!node.isTextOnly() && node.hasContent()) {
					List<Element> l = node.elements();
					for(Element ele : l){
						stack.push(ele);//所有非文本的节点一下子“装”
					}
					
				}
				else{
					System.out.println(node.getTextTrim());
				}
			}

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念