Method: Document.createTreeWalker()

Availability

BlackBerry Device Software version 4.6 or later

The createTreeWalker() method creates a TreeWalker object, which you can use to traverse the specified document subtree.

Syntax

Document.createTreeWalker( root, whatToShow, filter, expandEntityReference )

Parameters

Parameter

Type

Description

root

Node

The node that will serve as the root for this TreeWalker object. The TreeWalker.currentNode property is set to the value of root.

whatToShow

unsigned long

The types of nodes to show in the tree view. The value may be one or more of:

  • 0xFFFFFFFF = SHOW_ALL
  • 0x00000001 = SHOW_ELEMENT
  • 0x00000002 = SHOW_ATTRIBUTE
  • 0x00000004 = SHOW_TEXT
  • 0x00000008 = SHOW_CDATA_SECTION
  • 0x00000010 = SHOW_ENTITY_REFERENCE
  • 0x00000020 = SHOW_ENTITY
  • 0x00000040 = SHOW_PROCESSING_INSTRUCTION
  • 0x00000080 = SHOW_COMMENT
  • 0x00000100 = SHOW_DOCUMENT
  • 0x00000200 = SHOW_DOCUMENT_TYPE
  • 0x00000400 = SHOW_DOCUMENT_FRAGMENT
  • 0x00000800 = SHOW_NOTATION

Multiple values may be specified using a bitwise OR.

Note that because attributes, entities, and notations are not the child of any other node, they never appear in the TreeWalker object’s logical view unless root is defined as a Node of that type. If the respective object is not defined as the root, then SHOW_ATTRIBUTE, SHOW_ENTITY, and SHOW_NOTATION have no meaning.

filter

NodeFilter

The filter to use with this TreeWalker object. This parameter may be null.

entityReferenceExpansion

boolean

When true, this method specifies that entity reference nodes should be expanded.

Return values

Returns the new TreeWalker object.

Exceptions

Exception

Description

NOT_SUPPORTED_ERR

This error is thrown if the specified root is null.

See also

TreeWalker


Was this information helpful? Send us your comments.