Sash XB for Linux
Home |  Documentation  ... Contact

Using the SashXB XML Extension

Use this extension to parse an XML document. We provide ways to access the entire document and individual nodes. Iterating through the nodes of an entire document is also possible.

Please note that if you want to create a new Sash.XML.Node (say, to be added to an existing document), you must use the Sash.XML.Document.createNode() method.

1. Sash.XML

Constructors
Document
Creates an XML Document.
Iterator
Creates an XML Iterator.

2. Sash.XML.Document

Properties
readonly sashIXMLNode rootNode
The root node of the XML document.
Methods
boolean loadFromFile(string file_name)
Load from an XML file.
boolean saveToFile(string file_name)
Save to an XML file.
boolean loadFromString(string xml)
Load from an XML string.
string saveToString()
Save to an XML string.
void createRootNode(string tag_name)
Create a root node for the document with the specified tag name.
sashIXMLNode createNode(string tag_name)
Create a node for the document with the specified tag name.

3. Sash.XML.Node

Properties
readonly string name
The name of the node.
readonly sashIXMLNode parent
The parent node.
string text

string xml
The XML representation of the node.
Methods
boolean hasAttribute(string attribute_name)
Checks whether the node has a particular attribute name.
unsigned long hasAttributes([string pattern])
Counts the number of attributes that match the pattern.
string getAttribute(string attribute_name)
Gets the value of the specified attribute.
string setAttribute(string attribute_name, string value)
Sets the value of the specified attribute to value.
boolean removeAttribute(string attribute_name)
Removes the attribute specified.
array getAttributeNames([string pattern])
Gets attribute names that match the specified pattern.
unsigned long hasChildNodes([string pattern])
Returns the number of children that match the specified pattern.
array getChildNodes([string pattern])
Returns the children that match the specified pattern.
sashIXMLNode getFirstChildNode([string pattern])
Returns the first child that matches the specified pattern.
sashIXMLNode getNextSibling([string pattern])
Returns the next child that matches the specified pattern.
unsigned long removeChildNodes([string pattern])
Removes child nodes that match the specified pattern. Returns the number of nodes removed.
boolean removeChild(sashIXMLNode child)
Removes the specified child.
boolean appendChild(sashIXMLNode child)
Appends the specified child.
unsigned long appendChildNodes(array children)
Appends the specified children, an array of sashIXMLNodes.
boolean appendXML(string xml)
Appends the specified xml string.

4. Sash.XML.Iterator

Methods
boolean hasNext()
Returns true if there is another Node.
sashIXMLNode getNext()
Returns the next node.
void begin()
Start the iterator at the root node.


Wing Yung
Last modified: Mon Apr 1 15:23:34 EST 2002

  
© Copyright 2002, All Rights Reserved. Contact