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

1.1     ! misho       1: :mod:`axl` --- PyAxlNode class: XML node instance 
        !             2: ==================================================
        !             3: 
        !             4: .. currentmodule:: axl
        !             5: 
        !             6: 
        !             7: =====
        !             8: Intro
        !             9: =====
        !            10: 
        !            11: :class:`axl.Node` class represents a single node instance that is hold
        !            12: by a document (:class:`axl.Doc`).
        !            13: 
        !            14: The usual operation is to load a document and the acquire a reference to the node inside as follows::
        !            15: 
        !            16:    # load the document
        !            17:    (doc, err) = axl.parse ("<root-node><child /></root-node>")
        !            18:    if err:
        !            19:       print ("Failed to parse content: " + err.msg)
        !            20:       return -1
        !            21: 
        !            22:    # get the <child> node
        !            23:    node = doc.get ("/root-node/child")
        !            24: 
        !            25: 
        !            26: However, you can also create new nodes using the type constructor of :class:`axl.Node` as follows::
        !            27: 
        !            28:   # set a new root node
        !            29:   doc.root = axl.Node ("test")
        !            30:    
        !            31: 
        !            32: ==========
        !            33: Module API
        !            34: ==========
        !            35: 
        !            36: .. class:: Node
        !            37: 
        !            38:    .. method:: next_called (node_name)
        !            39:    
        !            40:       Allows to get the next node on the same level or the instance
        !            41:       node, but with the provide name.
        !            42: 
        !            43:       :param node_name: node name to match.
        !            44:       :type  node_name: String 
        !            45: 
        !            46:       :rtype: Returns an instance of :class:`axl.Node` or None if no node was found.
        !            47: 
        !            48:    .. method:: previous_called (node_name)
        !            49:    
        !            50:       Allows to get the previous node on the same level or the instance
        !            51:       node, but with the provide name.
        !            52: 
        !            53:       :param node_name: node name to match.
        !            54:       :type  node_name: String 
        !            55: 
        !            56:       :rtype: Returns an instance of :class:`axl.Node` or None if no node was found.
        !            57: 
        !            58:    .. method:: child_called (node_name)
        !            59:    
        !            60:       Allows to get the first node child, but with the provide name.
        !            61: 
        !            62:       :param node_name: node name to match.
        !            63:       :type  node_name: String 
        !            64: 
        !            65:       :rtype: Returns an instance of :class:`axl.Node` or None if no node was found.
        !            66: 
        !            67:    .. method:: find_called (node_name)
        !            68:    
        !            69:       Gets the xml child node called as provided. The child is looked
        !            70:       up in all childs found starting the parent node.
        !            71: 
        !            72:       :param node_name: node name to match.
        !            73:       :type  node_name: String 
        !            74: 
        !            75:       :rtype: Returns an instance of :class:`axl.Node` or None if no node was found.
        !            76: 
        !            77:    .. method:: nth_called (position)
        !            78:    
        !            79:       Allows to get a reference to the child node located at the same
        !            80:       level at the nth position.
        !            81: 
        !            82:       :param position: node position.
        !            83:       :type  position: Integer 
        !            84: 
        !            85:       :rtype: Returns an instance of :class:`axl.Node` or None if no node was found.
        !            86: 
        !            87:    .. method:: has_attr (attr_name, [attr_value])
        !            88:    
        !            89:       Allows to check if the provided node has the given attribute.
        !            90: 
        !            91:       :param attr_name: the attribute name to check.
        !            92:       :type  attr_name: String
        !            93: 
        !            94:       :param attr_value: Optional the attribute value to check. If provided the method check if the node has an attribute with the provided value.
        !            95:       :type  attr_value: String
        !            96: 
        !            97:       :rtype: Returns the presence of the provided attribute on the given node, and optionall checking if that attribute has a particular value.
        !            98: 
        !            99:    .. method:: attr (attr_name, [value])
        !           100:    
        !           101:       Allows to get the value associated to the attribute (attr_name)
        !           102:       or to configure the provided value if two arguments are
        !           103:       provided.
        !           104: 
        !           105:       :param attr_name: the attribute name to get its value.
        !           106:       :type  attr_name: String
        !           107: 
        !           108:       :param value: If provided, allows to configure the value on the attribute (attr_name).
        !           109:       :type  value: String
        !           110: 
        !           111:       :rtype: Returns an instance of :class:`axl.Node` or None if no node was found.
        !           112: 
        !           113:    .. method:: set_child (node)
        !           114:    
        !           115:       Allows to configure a new child node.
        !           116: 
        !           117:       :param node: the new child node to configure.
        !           118:       :type  node: :class:`axl.Node`
        !           119: 
        !           120:    .. method:: attr_cursor_new ()
        !           121:    
        !           122:       Creates a new :class:`axl.AttrCursor` instance which is used to
        !           123:       perform efficient node attribute iteration. See axl_node_attr_cursor_new.
        !           124: 
        !           125:       :param node: the new child node to configure.
        !           126:       :type  node: axl.Node
        !           127: 
        !           128:    .. attribute:: name
        !           129: 
        !           130:       (Read only attribute) (String) Allows to get the node name.
        !           131: 
        !           132:    .. attribute:: first_child
        !           133: 
        !           134:       (Read only attribute) (:class:`axl.Node`) Allows to get first node child.
        !           135: 
        !           136:    .. attribute:: next
        !           137: 
        !           138:       (Read only attribute) (:class:`axl.Node`) Allows to get next node.
        !           139: 
        !           140:    .. attribute:: previous
        !           141: 
        !           142:       (Read only attribute) (:class:`axl.Node`) Allows to get previous node.
        !           143: 
        !           144:    .. attribute:: parent
        !           145: 
        !           146:       (Read only attribute) (:class:`axl.Node`) Allows to get parent node.
        !           147: 
        !           148:    .. attribute:: content
        !           149: 
        !           150:       (Read only attribute) (:class:`axl.Node`) Allows to get the node
        !           151:       content. See axl_node_get_content.
        !           152: 
        !           153:    .. attribute:: doc
        !           154: 
        !           155:       (Read only attribute) (:class:`axl.Doc`) Allows to get the document that holds the node.
        !           156: 

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