org.sakaiproject.tool.assessment.qti.util
Class XmlStringBuffer

java.lang.Object
  extended byorg.sakaiproject.tool.assessment.qti.util.XmlStringBuffer
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ASIBaseClass

public class XmlStringBuffer
extends Object
implements Serializable

Copyright: Copyright (c) 2004

Organization: Sakai Project

Version:
$Id: XmlStringBuffer.java 3338 2005-11-01 22:05:52Z esmiley@stanford.edu $
Author:
rshastri, Ed Smiley esmiley@stanford.edu
See Also:
Serialized Form

Constructor Summary
protected XmlStringBuffer()
          Constructor to be accessed by subclasses.
  XmlStringBuffer(Document document)
          Constructs an XmlStringBuffer whose initial value is Document
  XmlStringBuffer(org.jdom.Document jdomDoc)
          Deprecated. using XmlStringBuffer(org.w3c.dom.Document document) instead.
  XmlStringBuffer(String xml)
          Constructs an XmlStringBuffer whose initial value is String.
 
Method Summary
 void add(String parentXpath, String childXpath)
           
 void addAttribute(String elementXpath, String attributeName)
          add attribute
 void addElement(String parentXpath, Element element)
          add element
 void addJDOMElement(String xpath, org.jdom.Element element)
          Deprecated. addElement(String, org.w3c.dom.Element)
 void clear()
          Clears the xml
 Document getDocument()
          Get a document
 void insertElement(String afterNode, String parentXpath, String childXpath)
          insert element
 boolean isEmpty()
          is the xml empty?
 void removeElement(String xpath)
          remove element
 void replace(String xml)
          Deprecated.  
 List selectNodes(String xpath)
          get nodes
 String selectSingleValue(String xpath, String type)
          xpath lookup
 String stringValue()
          string value of document
 void update(String xpath, Element element)
          update element, xpath
 XmlStringBuffer update(String xpath, String value)
          perform Update on this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlStringBuffer

protected XmlStringBuffer()
Constructor to be accessed by subclasses.


XmlStringBuffer

public XmlStringBuffer(String xml)
Constructs an XmlStringBuffer whose initial value is String.

Parameters:
xml - XML string

XmlStringBuffer

public XmlStringBuffer(Document document)
Constructs an XmlStringBuffer whose initial value is Document

Parameters:
document - XML document

XmlStringBuffer

public XmlStringBuffer(org.jdom.Document jdomDoc)
Deprecated. using XmlStringBuffer(org.w3c.dom.Document document) instead.

Constructs an XmlStringBuffer whose initial value is Document

Parameters:
jdomDoc -
Method Detail

clear

public final void clear()
Clears the xml


replace

public final void replace(String xml)
Deprecated.  

replace the current xml with the given string

Parameters:
xml - XML replacement string

getDocument

public final Document getDocument()
                           throws ParserConfigurationException,
                                  SAXException,
                                  IOException
Get a document

Returns:
document
Throws:
ParserConfigurationException
SAXException
IOException

stringValue

public final String stringValue()
string value of document

Returns:
the string

isEmpty

public final boolean isEmpty()
is the xml empty?

Returns:
true/false

selectSingleValue

public String selectSingleValue(String xpath,
                                String type)
xpath lookup

Parameters:
xpath -
type -
Returns:
value

selectNodes

public final List selectNodes(String xpath)
get nodes

Parameters:
xpath -
Returns:
list of nodes

update

public final XmlStringBuffer update(String xpath,
                                    String value)
                             throws DOMException,
                                    Exception
perform Update on this object

Parameters:
xpath - :- xpath and
value - :- Value of xpath
Returns:
XmlStringBuffer
Throws:
DOMException
Exception

update

public final void update(String xpath,
                         Element element)
update element, xpath

Parameters:
xpath -
element -

addJDOMElement

public final void addJDOMElement(String xpath,
                                 org.jdom.Element element)
Deprecated. addElement(String, org.w3c.dom.Element)

DOCUMENT ME!

Parameters:
xpath -
element -

insertElement

public void insertElement(String afterNode,
                          String parentXpath,
                          String childXpath)
insert element

Parameters:
afterNode -
parentXpath -
childXpath -

add

public final void add(String parentXpath,
                      String childXpath)
Parameters:
parentXpath -
childXpath -

addElement

public final void addElement(String parentXpath,
                             Element element)
add element

Parameters:
parentXpath -
element -

addAttribute

public final void addAttribute(String elementXpath,
                               String attributeName)
add attribute

Parameters:
elementXpath -
attributeName -

removeElement

public final void removeElement(String xpath)
remove element

Parameters:
xpath -