以下是我的xml文件格式
<?xml version="1.0" encoding="UTF-8"?>
<Hospitals>
<Hospital hospitalId="14">
<HospitalName>aaa</HospitalName>
<Department>
<DepartmentName departmentId="21">card</DepartmentName>
<Clinics>
<ClinicName clinicId="38">c7</ClinicName>
<Status Flag="0">0</Status>
<ClinicName clinicId="39">c2</ClinicName>
<Status Flag="0">0</Status>
</Clinics>
</Department>
</Hospital>
<Hospital hospitalId="15">
<HospitalName>bbbb</HospitalName>
<Department>
<DepartmentName departmentId="22">dental</DepartmentName>
<Clinics>
<ClinicName clinicId="35">c6</ClinicName>
<Status Flag="0">0</Status>
<ClinicName clinicId="36">c5</ClinicName>
<Status Flag="0">0</Status>
</Clinics>
</Department>
</Hospital>
帮助我使用从 xml 读取的 java 代码以打印如下所示的 alues。我尝试了这个,但我能够按如下所示的格式打印
Root element :Hospitals
----------------------
hospital Id : 14
Hospital Name : aaa
department Id : 21
Department Name : card
clinicId : 38
ClinicName : c7
status : 0
Flag : 0
clinicId : 38
ClinicName : c2
status : 0
Flag : 0
----------------------
hospital Id : 15
Hospital Name : bbbb
department Id : 22
Department Name : dental
clinicId : 35
ClinicName : c6
status : 0
Flag : 0
clinicId : 38
ClinicName : c5
status : 0
Flag : 0
任何形式的帮助都将帮助我快速完成工作......在此先感谢