Package xode :: Module parser
[show private | hide private]
[frames | no frames]

Module xode.parser

XODE Importer for PyODE


This module is part of the implementation of an XODE importer. It is part of the PyODE package. The parser uses the xml.parsers.expat module.

The parser creates a tree from an XODE document which the programmer can query or transverse. Many of the tree nodes correspond to ODE objects but some are present merely for organisation (such as the Group node).

Currently, the following features of XODE are not supported:


Here's an example showing how to parse a document and transverse the resultant tree:
 | from xode import parser
 | import ode
 | f = file('xode-document.xml')
 | p = parser.Parser(f)
 | root = p.parseFile(f)
 | # Retrieve named objects
 | body1 = root.childNamed('body1').getODEObject()
 | joint1 = root.childNamed('joint1').getODEObject()
 | # Transverse the tree printing object names
 | def transverse(node):
 |     print node.getName()
 |     for c in node.getChildren():
 |         transverse(c)
 | transverse(root)

Author: Timothy Stranex

See Also: node.TreeNode

Parser An XODE parser.
Root The root of the object structure.
Space Represents an ode.Space object and corresponds to the <space> tag.
World Represents an ode.World object.

Generated by Epydoc 2.1 on Sun Feb 4 17:54:12 2007