Java 提取XML中出现的多个标记的值
我想提取标记的值,它在XML文件中多次出现,递归或非递归。我该怎么做 例如:Java 提取XML中出现的多个标记的值,java,xml,Java,Xml,我想提取标记的值,它在XML文件中多次出现,递归或非递归。我该怎么做 例如: <title>National Origins of Books</title> 书籍的民族起源 我尝试在Java中使用以下内容: jounralNodeList = document.getElementsByTagName("title"); Node childNode = (Node) jounralNodeList.item(0).getChildNodes(); for (in
<title>National Origins of Books</title>
书籍的民族起源
我尝试在Java中使用以下内容:
jounralNodeList = document.getElementsByTagName("title");
Node childNode = (Node) jounralNodeList.item(0).getChildNodes();
for (int i = 0; i < childNode.getChildNodes().getLength(); i++)
journalName = childNode.getChildNodes().item(i).getTextContent();
journralnodelist=document.getElementsByTagName(“title”);
Node childNode=(Node)jounralNodeList.item(0.getChildNodes();
对于(int i=0;i
但这只给了我第一次出现的值。如果用Python或Ruby很容易做到,我不介意。至少发布一个XML示例。试试这个'jounralNodeList=document.getElementsByTagName(“title”);对于(int i=0;i