ca.umontreal.iro.rali
Class SpineDocument

java.lang.Object
  extended by ca.umontreal.iro.rali.SpineDocument

public class SpineDocument
extends java.lang.Object

Author:
Guy Lapalme, Université de Montréal, 2009

Method Summary
protected  void addBottom(org.w3c.dom.Node n)
          Insert a node n at the bottom of the spine document Initialize the spine document if necessary Modify the bottom global variable
protected  java.lang.String buildXPath(org.w3c.dom.Node node)
          Creates a string representation of the skeleton document starting from a given node
protected  org.w3c.dom.Node getBottom()
           
protected  org.w3c.dom.Document getDoc()
           
static void main(java.lang.String[] args)
          For Unit Testing
protected  int nbNodes()
          count the number of nodes in the document useful for debugging memory leaks...
protected  int nbNodes(org.w3c.dom.Node n)
          count the number of nodes starting from a given node
static java.lang.String quotedString(java.lang.String s)
          Create a properly quoted string taking into account the fact that it can contain either single or double quote or both
protected  void removeBottom()
          remove the bottom node (and all its children) by modifying the bottom global variable
protected  void removeUpTo(org.w3c.dom.Node n)
          remove all nodes (and its children) from bottom up to (and including) n
protected  void upBottom()
          set the bottom element to its parent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDoc

protected org.w3c.dom.Document getDoc()

getBottom

protected org.w3c.dom.Node getBottom()

addBottom

protected void addBottom(org.w3c.dom.Node n)
Insert a node n at the bottom of the spine document Initialize the spine document if necessary Modify the bottom global variable

Parameters:
n - node to add at the bottom
Throws:
org.w3c.dom.DOMException
javax.xml.stream.XMLStreamException

removeBottom

protected void removeBottom()
remove the bottom node (and all its children) by modifying the bottom global variable


upBottom

protected void upBottom()
set the bottom element to its parent


removeUpTo

protected void removeUpTo(org.w3c.dom.Node n)
remove all nodes (and its children) from bottom up to (and including) n

Parameters:
n -

nbNodes

protected int nbNodes()
count the number of nodes in the document useful for debugging memory leaks...

Returns:
number of nodes

nbNodes

protected int nbNodes(org.w3c.dom.Node n)
count the number of nodes starting from a given node

Parameters:
n - the node to start the count from
Returns:
number of nodes

buildXPath

protected java.lang.String buildXPath(org.w3c.dom.Node node)
Creates a string representation of the skeleton document starting from a given node

Parameters:
node - node of the skeleton document
Returns:
String showing the path expression of the leaf of the skeleton document

quotedString

public static java.lang.String quotedString(java.lang.String s)
Create a properly quoted string taking into account the fact that it can contain either single or double quote or both

Parameters:
s - input string
Returns:
quoted input string

main

public static void main(java.lang.String[] args)
For Unit Testing

Parameters:
args -