日期:2014-05-20 浏览次数:20707 次
Iterator i = root.elementIterator();
Element e = ((Element)i.next());
for(i = root.elementIterator(); i.hasNext(); )
{
Element element = ((Element)i.next());
//System.out.print(element.attributeValue("name")+"\t\t");
//System.out.print(element.attributeValue("type")+"\n");
System.out.print(element.getText()+"\n");
sName.add(element.getText());
//i=((Iterator) i.next());
//下面想要遍历i.next()的下一个元素,该怎么改呢?
Element element1 = ((Element)i.next());
sType.add(element1.getText());
}
//把属性值写入ArrayList并打印
System.out.println("********************************");
Iterator i = root.elementIterator();
while(i.hasNext() )
{
Element element = ((Element)i.next());
System.out.print(element.getText()+"\n");
sName.add(element.getText());
//i=((Iterator) i.next());
//下面想要遍历i.next()的下一个元素,该怎么改呢?
Element element1 = ((Element)i.next());
sType.add(element1.getText());
}
//把属性值写入ArrayList并打印
System.out.println("********************************");