您好我已经在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();
}
Run Code Online (Sandbox Code Playgroud)
这里有一些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>
.....
.....
.....
Run Code Online (Sandbox Code Playgroud)
谢谢您的回答