您好,我已经在 java 中编写了小类以将 xml 文件作为字符串读取,但我的问题不是如下:如何附加字符串以便它仅输出 Physical_Order_List_Array 标签之间的内容
这是一个java类:
public static String getFileContent(String fileName)
{
BufferedReader br = null;
StringBuilder sb = new StringBuilder();
try {
br = new BufferedReader(new FileReader(fileName));
try {
String s;
while((s = br.readLine()) != null)
{
sb.append(s);
sb.append("\n");
}
}
finally {
br.close();
}
}
catch (Exception ex) {
ex.printStackTrace();
}
return sb.toString();
}
这是一些相当大的xml文件:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
.....
.....
.....some content
....here is what I only need
<Physical_Order_List_Array>
....now I need to get this portion of the code, append string to only output what is beetween these tags, including these tags as well
</Physical_Order_List_Array>
.....
.....
.....
谢谢您的回答