Annotation of gpl/axl/py-axl/doc/attr_cursor.rst, revision 1.1

1.1     ! misho       1: :mod:`axl` --- PyAxlAttrCursor class: xml node attributes iterator
        !             2: ==================================================================
        !             3: 
        !             4: .. currentmodule:: axl
        !             5: 
        !             6: 
        !             7: =====
        !             8: Intro
        !             9: =====
        !            10: 
        !            11: :class:`axl.AttrCursor` class represents an iterator cursor that
        !            12: maintains state of the current element selected. It is created using a
        !            13: node (:class:`axl.Node`) and later calls to
        !            14: :meth:`axl.AttrCursor.next` and :meth:`axl.AttrCursor.has_item`
        !            15: are used to check all attributes stored on a node::
        !            16: 
        !            17:    # get node 
        !            18:    node   = doc.get ("/document/child")
        !            19: 
        !            20:    # create the cursor
        !            21:    cursor = node.cursor_new ()
        !            22:    while node.has_item ():
        !            23:         # print content
        !            24:         print ("found attribute: " + node.key + "=" + node.value)
        !            25:         
        !            26:         # next item
        !            27:         cursor.next ()
        !            28:    
        !            29: 
        !            30: ==========
        !            31: Module API
        !            32: ==========
        !            33: 
        !            34: .. class:: AttrCursor
        !            35: 
        !            36:    .. method:: first ()
        !            37:    
        !            38:       Set the cursor to point to the first attribute.
        !            39: 
        !            40:    .. method:: nexut ()
        !            41:    
        !            42:       Set the cursor to point to the next attribute.
        !            43: 
        !            44:    .. method:: has_item ()
        !            45:    
        !            46:       Check if the cursor is pointing to an item (or previous call to
        !            47:       :meth:`axl.AttrCursor.next` has succeeded.
        !            48: 
        !            49:       :rtype: Returns True in the case the cursor points to an item. Otherwise, False is returned. The method returns False  once the cursor have iterated over all attributes.
        !            50: 
        !            51:    .. method:: has_next ()
        !            52:    
        !            53:       Check if the cursor points to an item that has a next attribute.
        !            54: 
        !            55:       :rtype: Returns True in the case there are a next item. Otherwise, False is returned.
        !            56: 
        !            57:    .. attribute:: key
        !            58: 
        !            59:       (Read only attribute) (String) Allows to get the current attribute name pointed by the cursor.
        !            60: 
        !            61:    .. attribute:: value
        !            62: 
        !            63:       (Read only attribute) (String) Allows to get the value associated to the attribute pointed by the cursor.
        !            64: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>