Copyright ® (1997-2003) EDMGROUP Pty Ltd - XML Database - XSTORAGE Reference

xdocument_add_node

[This is preliminary documentation and subject to change.]

Add child node to current node
Status:

Ready

Visual Basic Syntax

Private Declare Function xdocument_add_node
Lib "xmllab_dll.dll"

(ByVal DocObject As Long,ByVal ParentNode As Long,ByVal NodeType As Long,ByVal Name As String,ByVal Value As String,ByRef XML_CHILD As Long)
As Long

 

Example

The following Microsoft® Visual Basic® example demonstrates how new XDocument can be created inside XStorage

 

Private Sub xdocument_new_Click()
Dim Res, DocObject, XML_NODE, XML_ROOT, XML_DOC_ROOT, Error As Long
Dim DOCNAME As String
Dim Result As Long
Dim XSTORAGE_STAT As String, ERROR_BUFFER As String
XSTORAGE_STAT = String(255, " ")
Result = xstorage_status(XSTORAGE_STAT)
If Result = 0 Then
DOCNAME = File1.Path & "\" & "new_document.xml"
Res = xdocument_create(DOCNAME, DocObject)
If DocObject <> 0 Then
'Now Get properties of created document
XML_ROOT = xdocument_root(DocObject)
'Now create root element of the document
Res = xdocument_add_node (DocObject, XML_ROOT, 1, "document_root", "", XML_DOC_ROOT)
If Res = 0 Then
Res = xdocument_add_node (DocObject, XML_DOC_ROOT, 1, "my_node", "my value 1", XML_NODE)
If Res = 0 Then
'Now add attributes for the node
Res = xdocument_add_attr(XML_NODE, "attribute1", "my value of attribute1")
Res = xdocument_add_attr(XML_NODE, "attribute2", "my value of attribute2")
Else
MsgBox "Error creating XML_NODE. Retcode = " & XML_NODE
End If
Res = xdocument_add_node (DocObject, XML_DOC_ROOT, 1, "my_node", "my value 2", XML_NODE)
If Res = 0 Then
'Now add attributes for the node
Res = xdocument_add_attr(XML_NODE, "attribute1", "my value of attribute1")
Res = xdocument_add_attr(XML_NODE, "attribute2", "my value of attribute2")
End If
'Now - reload documents in XStorage
Call fill_loaded
Else
ERROR_BUFFER = String(1000, " ")
Error = vb_xstorage_errors(ERROR_BUFFER)
MsgBox "Error creating document root. Error = " & Error & "," & ERROR_BUFFER
End If
Else
'ERROR = 0
'ERROR_BUFFER = String(1000, " ")
'ERROR= vb_xstorage_errors(ERROR_BUFFER)
MsgBox "Error creating new document in XStorage. Res = " & Res & ", DocObject = " & DocObject
End If
Else
MsgBox "XStorage is not initialized or not loaded. Operation failed"
End If
End Sub
[C/C++]

C/C++ Syntax

   

Under development

 

C/C++ Return Values

C Sample

Under development

 

Remarks

 

See Also

 

  Contact Us   |   |  

 © 1997-2003 EDMGROUP (Australia) Pty Ltd. All rights reserved.