I have a simple function used to export records from a table into a XML format. I can't seem to get the root node schema to print out....what I need is the
"root xmlns:xsd=" xmlns:xsi=" etc...
Am I missing something obvious and simple? Here is my code:
Thanks in advance!
TN
"root xmlns:xsd=" xmlns:xsi=" etc...
Am I missing something obvious and simple? Here is my code:
Code:
Public Sub testimport()
'Create XMLDOM Object
Dim xmldoc
Dim strSql As String
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim f As Object
Dim fs As Object
' Build the XML document
Set xmldoc = CreateObject("Microsoft.XMLDOM")
xmldoc.async = False
xmldoc.Load ("<?xml version='1.0' encoding='UTF-8' ?>")
' Queries the database for class code data
strSql = "SELECT userclass,definition FROM BUDef"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSql, dbOpenDynaset)
If (xmldoc.childNodes.length = 0) Then
' Create root node
Set root = xmldoc.createNode("element", "root", "")
xmldoc.appendChild (root)
rs.MoveFirst
'Loop through the recordset
Do While Not rs.EOF
Set inode = xmldoc.createNode("element", "platformPrivileges", "")
root.appendChild (inode)
Set child = xmldoc.createNode("element", "platformCode", "")
child.Text = "Cognos"
inode.appendChild (child)
Set child = xmldoc.createNode("element", "privilegeCode", "")
child.Text = rs.fields(0)
inode.appendChild (child)
Set child = xmldoc.createNode("element", "description", "")
child.Text = rs.fields(1)
inode.appendChild (child)
rs.MoveNext
Loop
Set rs = Nothing
End If
'Save the XML doc
xmldoc.Save ("C:\saved.xml")
End Sub
Thanks in advance!
TN