June 2000
Intermediate to advanced
556 pages
8h 45m
English
Pyxie maintains an active node for every xTree object. A variety of methods act on the tree, taking into account the currently active node. The most fundamental are the navigation primitives known as Up, Down, Left, and Right.
When an xTree is created, the active node is set to the root node. In the following program, the active position is moved downward twice, and the element type name of the new node is printed.
CD-ROM reference=12014.txt
"""
Print the element type name of the first,
Second-generation descendant of the root node.
"""
from pyxie import *
import sys
t = File2xTree (sys.argv[1])
t.Down()
t.Down()
print t.ElementTypeName
C>type hello.xml <?xml version="1.0"?> <greeting><hello><foo/></hello></greeting> C>python ...Read now
Unlock full access