parsing nodes that are not always present #558
-
I am trying to use this to simply parse a gpx file and it works. the only problem I have is that when using a file that does not always contain a given node then that node is never present in the tree and therefore I cannot see it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
According to the document. |
Beta Was this translation helpful? Give feedback.
According to the document.
There is a special value of xml_node type, known as null node or empty node. It does not correspond to any node in any document, and thus resembles null pointer. However, all operations are defined on empty nodes; generally the operations don’t do anything and return empty nodes/attributes or empty strings as their result. This is useful for chaining calls; i.e. you can get the grandparent of a node like so: node.parent().parent(); if a node is a null node or it does not have a parent, the first parent() call returns null node; the second parent() call then also returns null node, so you don’t have to check for errors twice. You can test if a handle is null via …