Package xode ::
Module parser
|
|
Module xode.parser
XODE Importer for PyODE
Introduction
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:
-
Quaternion and axis-angle rotation modes
-
Groups
-
Joints other than BallJoint
-
Extension support
Usage
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
Classes |
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. |