org.gxos.xml
Interface XMLObject

All Known Implementing Classes:
GxContext, TreeObjectContext

public interface XMLObject

Memory XML object interface for GXOS API.

$Id: XMLObject.java,v 1.3 2001/10/09 19:19:30 balsoy Exp $


Method Summary
 void addObject(XMLObject object)
          Adds an XML object as a child XML object into this XML object.
 java.util.Enumeration enumerateChildren()
          Returns an enumeration of child objects.
 XMLObject getChild(java.lang.String name)
          Returns the child object whose name is as given.
 java.lang.String[] getChildren()
          Returns a list of child XML obhects' names.
 java.lang.String getName()
          Returns the name of this XML object.
 java.lang.String getParameter(java.lang.String key)
          Returns the parameter value associated with this attribute value.
 XMLObject getParentXMLObject()
          Returns the parent of this XML object.
 java.lang.String getURI()
          Returns the URI of this XML object.
 java.lang.String getXML()
          Returns contents of this XML object as an XML document.
 void removeObject(java.lang.String name)
          Removes an XML object from children list of this XML object.
 void setParameter(java.lang.String key, java.lang.String value)
          Returns the parameter value associated with this attribute value.
 void updateObject()
          Writes any changes of XML object back to the database.
 void updateObject(XMLObject object)
          Replaces an XML object with a new one or updated one.
 

Method Detail

getName

public java.lang.String getName()
                         throws XMLException
Returns the name of this XML object. This is relative to its parent.

Returns:
name of this XML object.
Throws:
XMLException - if an error is encountered.

getURI

public java.lang.String getURI()
                        throws XMLException
Returns the URI of this XML object. This is the absolute name of this object.

Returns:
URI of this XML object.
Throws:
XMLException - if an error is encountered.

getParentXMLObject

public XMLObject getParentXMLObject()
                             throws XMLException
Returns the parent of this XML object.

Returns:
parent of this XML object.
Throws:
XMLException - if an error is encountered.

getChild

public XMLObject getChild(java.lang.String name)
                   throws XMLException
Returns the child object whose name is as given. Name is relative to this XML object. Immediate children are refered by their names. Children objects at deeper levels are refered by their paths including their ancestors. As an example, if this is the hierarchy:
    this object
    . child_1
        . grandchild_1
    . child_2
        . grandchild_2
        . grandchild_3
 
then object retrieval can be this.getChild("child_1") or this.getChild("child_2/grandchild_3") and so on.

Parameters:
name - name of the XML object
Returns:
child XML object
Throws:
XMLException - if an error is encountered.

addObject

public void addObject(XMLObject object)
               throws XMLException
Adds an XML object as a child XML object into this XML object.

Parameters:
object - any XML object.
Throws:
XMLException - if an error is encountered.

updateObject

public void updateObject()
                  throws XMLException
Writes any changes of XML object back to the database.

Throws:
XMLException - if an error is encountered.
See Also:
updateObject(XMLObject)

updateObject

public void updateObject(XMLObject object)
                  throws XMLException
Replaces an XML object with a new one or updated one. New object's name must be the same as the old one.

Parameters:
object - any XML object.
Throws:
XMLException - if an error is encountered.
See Also:
updateObject()

removeObject

public void removeObject(java.lang.String name)
                  throws XMLException
Removes an XML object from children list of this XML object. Name is relative to this object. See getChild(String) for name usage.

Parameters:
name - name of the child object to be removed.
Throws:
XMLException - if an error is encountered.

getXML

public java.lang.String getXML()
                        throws XMLException
Returns contents of this XML object as an XML document.

Returns:
XML content as Java String object.
Throws:
XMLException - if an error is encountered.

getChildren

public java.lang.String[] getChildren()
                               throws XMLException
Returns a list of child XML obhects' names.

Returns:
an array of XML object names
Throws:
XMLException - if an error is encountered.

enumerateChildren

public java.util.Enumeration enumerateChildren()
                                        throws XMLException
Returns an enumeration of child objects. Each object has to be casted to XMLObject.

Returns:
enumeration of child XML objects
Throws:
XMLException - if an error is encountered.

getParameter

public java.lang.String getParameter(java.lang.String key)
                              throws XMLException
Returns the parameter value associated with this attribute value. If not found, search continues for ancestor contexts until the root node is reached.
Parameters:
key - key to retrieve a parameter value
Returns:
parameter value; null if key not found.
See Also:
setParameter(java.lang.String, java.lang.String)

setParameter

public void setParameter(java.lang.String key,
                         java.lang.String value)
                  throws XMLException
Returns the parameter value associated with this attribute value. If not found, search continues for ancestor contexts until the root node is reached.
Parameters:
key - key that the value will be associated.
value - value to retrive with the given key.
See Also:
getParameter(java.lang.String)