Class XmlStringBuffer
- java.lang.Object
-
- org.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$
- Author:
- rshastri, Ed Smiley esmiley@stanford.edu
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedXmlStringBuffer()Constructor to be accessed by subclasses.XmlStringBuffer(String xml)Constructs an XmlStringBuffer whose initial value is String.XmlStringBuffer(org.jdom.Document jdomDoc)Deprecated.using XmlStringBuffer(org.w3c.dom.Document document) instead.XmlStringBuffer(Document document)Constructs an XmlStringBuffer whose initial value is Document
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(String parentXpath, String childXpath)voidaddAttribute(String elementXpath, String attributeName)add attributevoidaddElement(String parentXpath, Element element)add elementvoidaddJDOMElement(String xpath, org.jdom.Element element)Deprecated.addElement(String, org.w3c.dom.Element)voidclear()Clears the xmlprotected ElementcreateChildElement(String childXpath)create childDocumentgetDocument()Get a documentStringgetValueOf(String xpath)voidinsertElement(String afterNode, String parentXpath, String childXpath)insert elementbooleanisEmpty()is the xml empty?voidremoveElement(String xpath)remove elementvoidreplace(String xml)Deprecated.ListselectNodes(String xpath)get nodesStringselectSingleValue(String xpath, String type)xpath lookupStringstringValue()string value of documentXmlStringBufferupdate(String xpath, String value)perform Update on this objectvoidupdate(String xpath, Element element)update element, xpath
-
-
-
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:
ParserConfigurationExceptionSAXExceptionIOException
-
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 andvalue- :- Value of xpath- Returns:
- XmlStringBuffer
- Throws:
DOMExceptionException
-
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-
-
createChildElement
protected final Element createChildElement(String childXpath)
create child- Parameters:
childXpath-- Returns:
-
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-
-
-