我在从 xml 文件中提取数据时遇到问题:
<diagnosis_list>
<diagnosis>
<icd_code V="A00.-"/>
<description V="Cholera"/>
<diagnosis_list>
<diagnosis>
<icd_code V="A00.0"/>
<description V="Cholera durch Vibrio cholerae O:1, Biovar cholerae"/>
<dangerous V="j"/>
<subcategories_list>
<subcategory V="Klassische Cholera"/>
</subcategories_list>
</diagnosis>
<diagnosis>
<icd_code V="A00.1"/>
<description V="Cholera durch Vibrio cholerae O:1, Biovar eltor"/>
<dangerous V="j"/>
<subcategories_list>
<subcategory V="El-Tor-Cholera"/>
<subcategory V="Choleraartige Dysenterie"/>
<subcategory V="El-Tor-Enteritis"/>
</subcategories_list>
</diagnosis>
</diagnosis_list>
</diagnosis>
</diagnosis_list>
我用 nokigiri 和 Css 尝试了几件事,但并没有真正成功。作为输出,我想要类似的东西:
A00.- => Cholera
A00.0 => Cholera durch Vibrio cholerae O:1, Biovar cholerae
Subcategories => Klassische Cholera
A00.1 => Cholera durch Vibrio cholerae O:1, Biovar eltor
Subcategories => El-Tor-Cholera
Choleraartige Dysenterie
El-Tor-Enteritis
但是现在的输出并不那么重要,我很高兴每个建议如何以正确的顺序访问 xml 的节点!谢谢