OpenQuizz
Une application de gestion des contenus pédagogiques
Node Class Reference
Inheritance diagram for Node:
Collaboration diagram for Node:

Public Member Functions

def __init__ (self, name)
 
def __str__ (self)
 
def __repr__ (self)
 
def appendChild (self, node)
 
def insertText (self, data, insertBefore=None)
 
def insertBefore (self, node, refNode)
 
def removeChild (self, node)
 
def reparentChildren (self, newParent)
 
def cloneNode (self)
 
def hasContent (self)
 

Data Fields

 name
 
 parent
 
 value
 
 attributes
 
 childNodes
 

Detailed Description

Represents an item in the tree

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name 
)
Creates a Node

:arg name: The tag name associated with the node

Member Function Documentation

◆ __repr__()

def __repr__ (   self)

◆ __str__()

def __str__ (   self)

◆ appendChild()

def appendChild (   self,
  node 
)
Insert node as a child of the current node

:arg node: the node to insert

◆ cloneNode()

def cloneNode (   self)
Return a shallow copy of the current node i.e. a node with the same
name and attributes but with no parent or child nodes

◆ hasContent()

def hasContent (   self)
Return true if the node has children or text, false otherwise

◆ insertBefore()

def insertBefore (   self,
  node,
  refNode 
)
Insert node as a child of the current node, before refNode in the
list of child nodes. Raises ValueError if refNode is not a child of
the current node

:arg node: the node to insert

:arg refNode: the child node to insert the node before

◆ insertText()

def insertText (   self,
  data,
  insertBefore = None 
)
Insert data as text in the current node, positioned before the
start of node insertBefore or to the end of the node's text.

:arg data: the data to insert

:arg insertBefore: True if you want to insert the text before the node
    and False if you want to insert it after the node

◆ removeChild()

def removeChild (   self,
  node 
)
Remove node from the children of the current node

:arg node: the child node to remove

◆ reparentChildren()

def reparentChildren (   self,
  newParent 
)
Move all the children of the current node to newParent.
This is needed so that trees that don't store text as nodes move the
text in the correct way

:arg newParent: the node to move all this node's children to

Field Documentation

◆ attributes

attributes

◆ childNodes

childNodes

◆ name

name

◆ parent

parent

◆ value

value

The documentation for this class was generated from the following file: