不知你这段程序到底是要干嘛,但是,如果获取属性的话,你可以试试:NamedNodeMap nnm = node.getAttributes(); for(int j=0;j nnm.item(j); }