Anfang des Inhaltsbereichs

HintergrunddokumentationHintergrunddokumentation Interface if_ixml_node_iterator  Dokument im Navigationsbaum lokalisieren

In several popular approaches to software design, iterators are considered a basic building block for building reusable software and software libraries. For instance, they are fundamental to the Design Patterns approach, STL, and the Java libraries. The main advantages of node iterators in the DOM are:

  1. Abstracting out the way that specific data structures are navigated. Functions that use iterators can operate on any data structure without knowing the details of how that data structure is navigated; e.g., the same function could process the nodes in a document, a document subtree, or a nodelist. The function can keep asking for the next node without worrying about how that node is found.
  2. Allowing more efficient navigation. Because an iterator hides the manner in which a data structure is navigated, it can use indexes or other supplementary data structures to allow more efficient navigation than might be possible by naively navigating from one node to the next.
  3. Providing views for the most common ways applications want to navigate document structures. Some applications traverse only the element tree, others process additional nodes such as processing instructions or comments, others prefer yet another view. There is no one right way to navigate a document tree, but iterators provide a simple, efficient way to choose the most appropriate view of the document tree for a given application.

An iterator allows the nodes of a data structure to be returned sequentially. When an iterator is first created, calling getNext () returns the first node. When no more nodes are present, getNext () returns null. It is important to remember that DOM structures may change as a document is loaded - when getNext () finds no more nodes, it is still quite possible that further nodes may be added in the next instant. Since iterators do not know how to predict the future, there is no way to check whether further nodes may be added at any given time.

specializes

enumerations

methods

 

 

method get_filter

Gets the node filter currently set for this iterator.

interface

if_ixml_node_iterator

return value

Returns the node filter currently set or null if no one is currently set.

abap signature

method get_filter

returning

value(rval) type ref to if_ixml_node_filter.

 

 

method get_next

Moves this iterator to the next node in the set of nodes iterated over. If the iterator is initial (e.g. after calling iXMLNodeIterator::reset() or immediately after creation), this method returns the first node in the set of nodes.

interface

if_ixml_node_iterator

return value

Returns the next node in the set being iterated over, or null if there are no more members in that set.

abap signature

method get_next

returning

value(rval) type ref to if_ixml_node.

 

 

method reset

Resets the iterator to the same state as a new iterator would be if constructed by the same factory method with the same arguments as used to construct this iterator.

interface

if_ixml_node_iterator

abap signature

method reset.

 

 

method set_filter

Sets a node filter for this iterator, i.e. the iterator will only iterate over nodes which are accepted by the given filter. Node filters can e.g. be created via the iXMLNode::createFilter...() factory methods.

interface

if_ixml_node_iterator

parameters

filter

The filter to set for this iterator.

return value

Returns one of the following return codes:

ixml_mr_dom_ok = 0

The specified filter was set successfully.

ixml_mr_dom_invalid_arg = 0x00020003L

The given filter is invalid.

ixml_mr_dom_not_supported = 0x0002000bL

This iterator does not support filters.

abap signature

method set_filter

importing

filter type ref to if_ixml_node_filter

returning

value(rval) type I.

 

 

method query_interface

Queries the specified interface.

interface

if_ixml_node_iterator

parameters

iid

The interface ID of the interface to query.

return value

Returns a reference to the queried interface or null if no such interface is supported.

abap signature

method query_interface

importing

iid type I

returning

value(rval) type I.