在 XML 中,原子节点与叶节点是否相同? [英] In XML, is an atomic node the same thing as a leaf node?

查看:30
本文介绍了在 XML 中,原子节点与叶节点是否相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 W3Schools 网站上有关 XML 的教程.这是我所在的页面:http://www.w3schools.com/xsl/xquery_terms.asp

I am working through a tutorial on the W3Schools website about XML. This is the page I'm on: http://www.w3schools.com/xsl/xquery_terms.asp

我对原子节点和叶节点之间的区别有点困惑.它们是一样的吗?我知道叶节点是没有任何子节点的节点,但似乎给定示例中的原子节点也没有任何子节点.

I'm a bit confused about the difference between an atomic node and a leaf node. Are they the same thing? I know that a leaf node is a node without any children, but it also seems that the atomic nodes in the given example don't have any children either.

W3Schools 网站说原子值是没有子节点或父节点的节点."一个节点当然不可能没有父节点,因为 XML 文档中的所有节点都必须位于根节点(文档根)下?

The W3Schools site says "Atomic values are nodes with no children or parent." Surely it's impossible for a node not to have a parent, as all the nodes in an XML document have to come under the root node (the document root)?

任何人都可以向我解释这一点,因为我很困惑.

Can anyone explain this to me as I'm confused.

谢谢.

推荐答案

示例表明J K. Rowling"是原子的.
它没有父母,也没有孩子.它本身只是一个值或一个节点.
(想象一个只有那一行的文本文件)

The example shows that "J K. Rowling" is atomic.
It has no parent, and no child. It's just a value or a node in itself.
(Imagine a text file with just that line)

但是这个:<author>J K. Rowling</author>,有一个父母和一个孩子.
* 父级:作者
* 孩子:J K.罗琳
作者可能没有父级,但它不是原子的,因为它有一个子级.
J K. Rowling 可能没有孩子,但它不是原子的,因为它有父母.

But this: <author>J K. Rowling</author>, has a parent and a child.
* Parent: author
* Child: J K. Rowling
Author may have no parent, but it is not atomic since it has a child.
J K. Rowling may have no child, but it is not atomic since it has a parent.

与此同时,叶节点没有子节点,但它可能有也可能没有父节点.
所以总的来说,原子节点只是叶节点的一个子集.

Meanwhile, a leaf node as no child, but it may or may not have a parent.
So overall, an atomic node is just a subset of a leaf node.

这篇关于在 XML 中,原子节点与叶节点是否相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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