xmlTreeView {RGtkViewers}R Documentation

Display a GUI tree representing an XML hierarchy

Description

This displays a top-level window containing a scrolling GtkTree object that represents the hierarchy of an XML document or node.

Usage

xmlTreeView(doc, createItem = function(x) gtkTreeItem(xmlName(x)))

Arguments

doc the source of the XML nodes. This can be the name of a file or URI in which case that document is read, or it can be the result from an earlier call to xmlTreeParse. or xmlRoot, i.e. an XMLDocument XMLNode object.
createItem a function that is used to create the GtkTreeItem from the XMLNode object. This makes it easy to create different views of the nodes and to specify any callbacks to customize the behavior of the nodes in the tree. See xmlView which is the function that uses this.

Value

An list containing the GtkWindow and the GtkTree objects.

Author(s)

Duncan Temple Lang <duncan@research.bell-labs.com>

References

http://www.omegahat.org/RGtk http://www.omegahat.org/RSXML

See Also

xmlView xmlTreeParse

Examples

   # basic view that uses the xmlName() value of a node.
  xmlTreeView("http://www.ggobi.org/data/flea.xml")

   # customized view that uses the xmlName() and class of the node
  xmlTreeView("http://www.ggobi.org/data/flea.xml",
               createItem = function(x)
                               gtkTreeItem(paste(xmlName(x), class(x)[1], sep=":"))) 

   # basic view that uses the xmlName() value of a node.
  xmlTreeView("http://www.ggobi.org/data/flea.xml",
               createItem = function(x) {
                              it <- gtkTreeItem(xmlName(x))
                              if(inherits(x, "XMLTextNode"))
                                it$AddCallback("select",
                                                function(node, w) {
                                                  print(xmlValue(node))
                                                }, data = x)
                              it
                            })

[Package RGtkViewers version 0.7 Index]