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.
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.
Thanks.
I find that w3schools is often a useful resource for looking up details of information that I knew once but had forgotten, but it's a very poor resource for learning new concepts. This example is typical: "Atomic values are nodes with no children or parent.". Wrong, totally wrong. Atomic values are not nodes. In the XDM model used by XQuery, there are two kinds of item, nodes and atomic values. I suggest you use a different resource that isn't going to cause unnecessary confusion by giving wrong information.
In the XQuery Data Model, an atomic value is not a node. It is a value labeled with an atomic type.
Hence, a node (even a leaf node) is never an atomic value, just like an atomic value is never a node. However, a node can be "atomized" to an atomic value, in which case its typed value is taken (if it has any).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With