元素节点和文本节点的区别 [英] Difference between Element node and Text Node

查看:51
本文介绍了元素节点和文本节点的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE people SYSTEM "validator.dtd">

<people>
    <student>
        <name>John</name>
        <course>Computer Technology</course>
        <semester>6</semester>
        <scheme>E</scheme>
    </student>

    <student>
        <name>Foo</name>
        <course>Industrial Electronics</course>
        <semester>6</semester>
        <scheme>E</scheme>
    </student>
</people>  

使用简单的 XML 语言 data </open-tag> 是一个元素.
根据我上面的 XML,<student>... </student> 是一个元素,其他标签也是如此.

In simple XML language <open-tag> data </open-tag> is an element.
As per my XML above, <student> ... </student> is an element and so are the other tags.

在DOM解析中,有一个Element节点和一个Text节点.参考我正在使用的书,<student>是一个Element节点和<name><course> 和其他嵌套标签是 Text 节点.

In DOM parsing, there is an Element node and a Text node. Referring to the book I am using, <student> is an Element node and <name>, <course> and the other nested tags are Text nodes.

所以,如果我正确理解 DOM,所有外部标签都是 Elements 而包含实际数据的标签是 Text 节点?

So, if I am understanding DOM properly, all the outer tags are Elements and the tags that contain the actual data are Text nodes ?

推荐答案

XML 中存在的所有 XML 元素都是一个元素节点.XML 元素中的文本是文本节点.

All the XML elements present in a XML is an element node. The text present in the XML elements are text nodes.

这篇关于元素节点和文本节点的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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