GEDCOM Node Functions

STRING xref(NODE);

cross reference index of

STRING tag(NODE);

tag of

STRING value(NODE);

value of

NODE parent(NODE);

parent node of

NODE child(NODE);

first child of

NODE sibling(NODE);

next sibling of

NODE savenode(NODE);

copy a node structure

fornodes (NODE, NODE_V) { commands }

loop through child nodes

traverse (NODE, NODE_V, INT_V) { commands }

loop through all descendent nodes

These functions provide access to the components of a GEDCOM node. All take a GEDCOM node as their only parameter, and each returns a different value associated with the node.

Xref returns the cross reference index of the node, if any; tag returns the tag of the node; and value returns the value of the node, if any. If there is no cross reference, xref returns null; if there is no value, value returns null.

Parent returns the parent node of the node, if any; child returns the first child node of the node, if any; and sibling returns the next sibling node of the node, if any. Whenever there is no such related node, these functions return null. These three functions allow simple navigation through a GEDCOM node tree.

Savenode makes a copy of the node, and the substructure of nodes below the node, that is passed to it. Beware: the memory used to make the copy is never returned to the system.

Fornodes is an iterator that loops through the child nodes of a GEDCOM node. Its first argument is a node expression, and its second parameter is a variable that iterates through each direct child node of the first node.

Traverse is an iterator providing a general method for traversing GEDCOM trees. Its first parameter is a node expression; its second parameter is a variable that iterates over every node under the first node in a top down, left to right manner; and its third parameter is a variable that is set to the level of the current node in the iteration.