简体   繁体   English

无法使用 Java 读取复杂的 XML 深层嵌套结构

[英]Unable to read complex XML deep nested structure using Java

Below is my sample xml, and I am unable to read the value - Johnson Elementary School from xml using my Java code.下面是我的示例 xml,我无法使用我的 Java 代码从 xml 读取值 - Johnson Elementary School。 I am able to read attributes, but not the value passed inside School ie.我能够读取属性,但不能读取 School 内部传递的值,即。 Johnson Elementary School.约翰逊小学。 Let me know.让我知道。

Blockquote块引用

<School>
   <Student>
     <name>John</name>
     <age>15</age>            
   </Student>
 Johnson Elementary School 
</School>

Blockquote块引用

Thanks Padma谢谢帕德玛

你,可能应该在你的“学校”对象上使用方法 .getText()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM