Documentation

VBDOM OleDll "VBDOM"
 Version: 1.0.0

Class "Document"

Represents the top level of the XML source. Includes methods and   properties used to obtain or create all other XML objects.

Documentation:

 Friend Sub cacheAddElement ( ByVal id As String,  objElement As Element )

Internal element cache update routine.

Parameters:
	•id -  Specifies the ID of the element.
	•objElement -  Specifies reference to element to update. If this is Nothing the element is removed form the cache.

Remarks
Used internally for Element object caching update.

 Public Function createElement ( ByVal tagName As String ) As Element

Creates an element node using the specified name.

Parameters:
	•tagName -  Name for the new element node. It is case sensitive. This name is subsequently available as the element node's nodeName property.

Returns
Element -  References to the new element or Nothing on failure.

Remarks
None

 Public Property Get documentElement ( ) As Element

Returns the root element of the document.

Returns
Element -  DOMElement object that represents the single element representing the root of the XML document tree. Returns Nothing if no root exists.

Remarks
None

 Friend Function internalGetElement ( ByVal id As String,  ByVal isNew As Boolean,  ByVal strTag As String ) As Element

Internal element allocation, initialization and caching routine.

Parameters:
	•id -  Specifies the ID of the element.
	•isNew -  Specifies whether the element is new one.
	•strTag -  Specifies the name of the element.

Returns
Element -  Element with specified ID.

Remarks
Used internally for Element object caching.

 Public Function load ( ByVal xmlSource As String ) As Boolean

Loads an XML document from the specified location.

Parameters:
	•xmlSource -  Indicator of the object that specifies the source for the XML document.

Returns
Boolean -  True if the load succeeded; False if the load failed.

Remarks
None

 Public Function nodeFromID ( ByVal idString As String ) As Element

Returns the node whose ID attribute matches the supplied value.

Parameters:
	•idString -  Value of the ID to match.

Returns
Element -  Node that matches the supplied ID. If no nodes match, this method returns Nothing.

Remarks
Only documentElement first level children can be selected.

 Public Sub save ( ByVal destination As String )

Saves an XML document to the specified location.

Parameters:
	•destination -  Specifies the file name. Note that this must be a file name rather than a URL. The file is created if necessary and the contents are entirely replaced with the contents of the saved document.

Remarks
Not implemented.

 Public Function selectNodes ( ByVal queryString As String ) As NodeList

Applies the specified pattern-matching operation to this node's   context and returns the list of matching nodes.

Parameters:
	•queryString -  XSL or XPath expression that is to be applied to the context defined by this node. Whether an XSL or XPath query is used is determined by the value of the SelectionLanguage property. By default, the expression is an XSL pattern query. The SelectionLanguage property can be set with the SetProperty method.

Returns
NodeList -  List of nodes selected by the XSL or XPath query. If no nodes are selected by the query, an empty node list is returned.

Remarks
SelectionLanguage and SetProperty properties are not implemented.

 Public Function selectSingleNode ( ByVal queryString As String ) As Element

Applies the specified pattern to this node's context and returns   the first matching node.

Parameters:
	•queryString -  String specifying the XSL or XPath query that is to be applied to the context defined by this node. Whether an XSL or XPath query is used is determined by the value of the SelectionLanguage property. By default, the expression is an XSL pattern query. The SelectionLanguage property can be set with the SetProperty method.

Returns
Element -  First node that is selected by the XPath query. If no nodes result from the query, it returns Nothing.

Remarks
Not implemented.   SelectionLanguage and SetProperty properties are not implemented.

Class "Element"

Represents the element object.

Documentation:

 Public Function appendChild ( ByVal newChild As Element ) As Element

Appends newChild as the last child of this node.

Parameters:
	•newChild -  Reference to the new child node to be appended to the end of the list of children of this node.

Returns
Element -  New child node successfully appended to the list. If Nothing,   no object is created.

Remarks
Node order is not implemented.

 Private Sub backup ( ByVal toBackup As Boolean )

Backups and restores the object state.

Parameters:
	•toBackup -  If True the current object data is stored in a static variables. If False, it is restored from the static storage.

Remarks
Used for transaction rollback for avoiding database roundtrip.

 Private Sub deleteElement ( )

Deletes the node from the database.

Remarks
Not used

 Public Function getAttribute ( ByVal name As String ) As String

Retrieves the value of the named attribute.

Parameters:
	•name -  Name of the attribute to return.

Returns
String -  String that contains the attribute value. The empty string is returned if the named attribute does not have a specified or default value.

Remarks
None

 Friend Property Let id ( ByVal strId As String )

Sets the id if the element.

Parameters:
	•strId -  Specifies the id of the element.

Remarks
The id is the primary key of the element in the database. The pair   id and tablename identyfy unique the element.

 Private Sub insertElement ( )

Inserts a new record in the database with the data from attribute   values collection.

Remarks
None

 Private Sub load ( )

Loads the attribute names, values and types from the database.

Remarks
None

 Public Property Get ownerDocument ( ) As Document

Returns reference to the owner document object.

Returns
Document -  Reference to the document object.

Remarks
None

 Friend Property Set ownerDocument ( ByRef doc As Document )

Sets the reference to the owner document object.

Parameters:
	•doc -  Specifies reference to the document object.

Remarks
None

 Public Property Get parentNode ( ) As Element

Returns the parent node (for nodes that can have parents).

Returns
Element -  Parent of the given node instance. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, the parent is Nothing.

Remarks
None

 Friend Sub reload ( )

Reloads the data from the database.

Remarks
Used for updating the object data before reading or writing any data   to the database in the context of a transaction.

 Public Function removeChild ( ByVal childNode As Element ) As Element

Removes the specified child node from the list of children and   returns it.

Parameters:
	•childNode -  Child node to be removed from the list of children of this node.

Returns
Element -  Removed child node. If Nothing, no object is removed.

Remarks
None

 Friend Sub restore ( )

Restores the state of the element previously backe up with backup.

Remarks
Used for restoring the state after transaction rollback.

 Public Function selectNodes ( ByVal queryString As String ) As NodeList

Applies the specified pattern-matching operation to this node's   context and returns the list of matching nodes.

Parameters:
	•queryString -  XSL or XPath expression that is to be applied to the context defined by this node. Whether an XSL or XPath query is used is determined by the value of the SelectionLanguage property. By default, the expression is an XSL pattern query. The SelectionLanguage property can be set with the SetProperty method.

Returns
NodeList -  List of nodes selected by the XSL or XPath query. If no nodes are selected by the query, an empty node list is returned.

Remarks
SelectionLanguage and SetProperty properties are not implemented.

 Public Function selectSingleNode ( ByVal queryString As String ) As Element

Applies the specified pattern to this node's context and returns   the first matching node.

Parameters:
	•queryString -  String specifying the XSL or XPath query that is to be applied to the context defined by this node. Whether an XSL or XPath query is used is determined by the value of the SelectionLanguage property. By default, the expression is an XSL pattern query. The SelectionLanguage property can be set with the SetProperty method.

Returns
Element -  First node that is selected by the XPath query. If no nodes result from the query, it returns Nothing.

Remarks
SelectionLanguage and SetProperty properties are not implemented.

 Public Sub setAttribute ( ByVal name As String,  ByVal value As String )

Sets the value of the named attribute.

Parameters:
	•name -  Name of the attribute to return.
	•value -   Name of the attribute. If an attribute with that name already exists, its value is changed.

Remarks
If an attribute with that name does not exist, it is NOT created.

 Friend Sub setDefAttribute ( ByVal strAttributeName As String )

Sets the name of the attribute returned as element's text.

Parameters:
	•strAttributeName -  Specifies the name of the attribute returned as default.

Remarks
Used internally for storing the name of the attribute for Attribute   nodes emulation.   <p>Also emulates element text (text()). This means that there caan be only   one text node.

 Friend Sub setNew ( ByVal blnIsNew As Boolean )

Sets the object as newly created object.

Parameters:
	•blnIsNew -  Specifies whether the object is new one.

Remarks
Used internally for flagging elements not appended to a existing   node. This flag is used for deciding whether to INSERT or UPDATE.

 Friend Sub setTag ( ByVal strTagName As String )

Sets the name of the element.

Parameters:
	•strTagName -  Specifies the name of the element.

Remarks
Used internally for storing the name of the database table.

 Public Property Get text ( ) As String

Returns the string representing the text contents of this node.

Returns
String -  The text representation of the contents of the node.

Remarks
None

 Public Property Let text ( ByVal strNewText As String )

Sets the text contents of this node.

Parameters:
	•strNewText -  String representing the text content of this node. This value varies depending on the value of the nodeType.

Remarks
None

 Private Sub updateAttribute ( ByVal strName As String )

Updates the value of named attribute in the database.

Parameters:
	•strName -  Name of attribute to update.

Remarks
If the id attribute is changed then the cache in the document object   is updated.

 Private Sub updateElement ( )

Updates the data in the database with that in the object.

Remarks
None

Class "NodeList"

The NodeList object supports indexed access to a collection of nodes.

Documentation:

 Public Property Get item ( ByVal index As Long ) As Element

Returns reference to a node by index.

Parameters:
	•index -  Specifies the index of the node to return.

Returns
Element -  Reference to the element of the collection with index <b>index</b>.

Remarks
None

 Public Property Get length ( ) As Long

Returns the number of nodes in the collection.

Returns
Long -  The number of nodes in the collection

Remarks
None

 Private Sub load ( )

Loads the internal collection of with the IDs of the collection   elements.

Remarks
None

 Friend Sub setOwnerDocument ( ByRef doc As Document )

Sets the reference to the owner document object.

Parameters:
	•doc -  Specifies reference to the document object.

Remarks
None

 Friend Sub setQueryString ( ByVal strQueryString As String )

Sets the SQL query string used for element selection.

Parameters:
	•strQueryString -  Specifies the SQL query string used for selecting colection elements.

Remarks
None

 Friend Sub setTag ( ByVal strTagName As String )

Sets the name of the elements in the collection.

Parameters:
	•strTagName -  Specifies the name of the elements in the collection.

Remarks
Corresponds to the table name.

Module "Utilities"

Library of utility functions.

Documentation:

 Public Function formatMessage ( ByVal format As String,  ParamArray args ( ) ) As String

This function formats a message string.

Parameters:
	•format -  Specifies the message definition.
	•args -  Specifies an array of values that are used as insert values in the formatted message. A %1 in the format string indicates the first value in the Arguments array; a %2 indicates the second argument; and so on.

Returns
String -  Formatted message.

Remarks
None