17.3. Converting an xTree to a wxTree, and Vice Versa

The heart of C3 is the relationship between an xTree object used to manipulate XML and the wxTreeCtrl object used to display and edit XML. The wxTreeCtrl class is based around the idea that a tree is made up of a collection of Item objects. There is a single root Item that contains all other Item objects. Building a wxTreeCtrl object from an xTree object makes heavy use of the AppendItem method. Given the Item object representing the parent item, this method appends a new Item as the last child of that parent. The InsertwxTreeChildren method uses an xTree as a template hierarchy from which to create a wxTreeCtrl hierarchy. The algorithm works by traversing the xTree in a top-down, left-to-right ...

Get XML Processing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.