使用DOM解析时如何识别xml结束标签? [英] how to identify for the xml end tag while parsing using DOM?

查看:59
本文介绍了使用DOM解析时如何识别xml结束标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想标识xml文件中每个元素的结束标记.

I want to identify end tag of each element in the xml file.

示例:

<Bank>
    <Account>
        <Id1>1001</Id1>
        <Name1>Sony Corporation</Name1>
        <Amt1>1000000</Amt1>
        <age>23</age>
   </Account>
   <Account>
        <Id2>1002</Id2>
        <Name2>Sony Corporation</Name2>
        <Amt2>1000000</Amt2>
   </Account>
</Bank>

现在我想确定

</Account> 

标签正在关闭.

在使用DOM解析xml文件时如何识别这样的结束标记?

How to identify such a end tag while parsing xml file using DOM?

推荐答案

DOM的抽象级别高于此级别.它不公开开始和结束标签,而是公开以树结构表示的节点.如果您告诉我们您要实现的目标(您要解决的问题,而不是解决问题的方式),那么我们可以建议正确的方法.

DOM is at a higher level of abstraction than this. It doesn't expose start and end tags, it exposes nodes, presented as a tree structure. If you tell us what you are trying to achieve (the problem you are trying to solve, not the way you are trying to solve it) then we could suggest the right approach.

这篇关于使用DOM解析时如何识别xml结束标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆