Hi guys i am trying out to following code
to export recordset to XML
//////////////////////////////////////////////////////////////////
Private Sub cmdMakeXmlFile_Click()
Dim db_name As String
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim xml As DOMDocument
Dim xml2 As DOMDocument
db_name = txtDatabase.Text
Set conn = New ADODB.Connection
conn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;" & _
"Data Source=" & db_name
conn.Open
Set rs = conn.Execute("SELECT * FROM Movies ORDER BY Title")
Set xml = New DOMDocument
Set xml2 = New DOMDocument
xml.async = False 'novo
xml2.async = False
rs.Save xml, adPersistXML
rs.Close
conn.Close
db_name = Replace$(db_name, ".mdb", ".xml")
xml.Save db_name
MsgBox "Done"
////////////////////////////////////////////////////////////////////
but i get xml scheme like
<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <s:Schema id="RowsetSchema">
- <s:ElementType name="row" content="eltOnly">
- <s:AttributeType name="Rate" rs:number="1" rs:nullable="true" rs:maydefer="true" rs:writeunknown="true">
<s:datatype dt:type="int" dt:maxLength="4" rsrecision="10" rs:fixedlength="true" />
</s:AttributeType>
- <s:AttributeType name="RDate" rs:number="2" rs:nullable="true" rs:maydefer="true" rs:writeunknown="true">
<s:datatype dt:type="dateTime" rs:dbtype="variantdate" dt:maxLength="16" rs:fixedlength="true" />
</s:AttributeType>
- <s:AttributeType name="Title" rs:number="3" rs:nullable="true" rs:maydefer="true" rs:writeunknown="true">
<s:datatype dt:type="string" dt:maxLength="40" />
</s:AttributeType>
<s:extends type="rs:rowbase" />
</s:ElementType>
</s:Schema>
- <rs:data>
<z:row Rate="2" RDate="2010-05-01T00:00:00" Title="Adam2" />
<z:row Rate="3" RDate="2010-05-01T00:00:00" Title="Adam3" />
<z:row Rate="4" RDate="2010-05-01T00:00:00" Title="Adam4" />
<z:row Rate="1" RDate="2010-05-01T00:00:00" Title="Adm" />
<z:row Rate="5" RDate="2010-05-01T00:00:00" Title="Eva" />
</rs:data>
</xml>
////////////////////////////////////////////////////////////////////
But i need a simple tree like
<?xml version="1.0" encoding="utf-8" ?>
- <Movies xmlns:xsi=" xmlns:xsd=" <MovieName>sws</MovieName>
<MovieRating>2011-07-30T00:00:00+03:00</MovieRating>
<MovieReleaseDate>223467</MovieReleaseDate>
</Movies>
/////////////////////////////////////////////////////////////////////
Any ideas?!
to export recordset to XML
//////////////////////////////////////////////////////////////////
Private Sub cmdMakeXmlFile_Click()
Dim db_name As String
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim xml As DOMDocument
Dim xml2 As DOMDocument
db_name = txtDatabase.Text
Set conn = New ADODB.Connection
conn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;" & _
"Data Source=" & db_name
conn.Open
Set rs = conn.Execute("SELECT * FROM Movies ORDER BY Title")
Set xml = New DOMDocument
Set xml2 = New DOMDocument
xml.async = False 'novo
xml2.async = False
rs.Save xml, adPersistXML
rs.Close
conn.Close
db_name = Replace$(db_name, ".mdb", ".xml")
xml.Save db_name
MsgBox "Done"
////////////////////////////////////////////////////////////////////
but i get xml scheme like
<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <s:Schema id="RowsetSchema">
- <s:ElementType name="row" content="eltOnly">
- <s:AttributeType name="Rate" rs:number="1" rs:nullable="true" rs:maydefer="true" rs:writeunknown="true">
<s:datatype dt:type="int" dt:maxLength="4" rsrecision="10" rs:fixedlength="true" />
</s:AttributeType>
- <s:AttributeType name="RDate" rs:number="2" rs:nullable="true" rs:maydefer="true" rs:writeunknown="true">
<s:datatype dt:type="dateTime" rs:dbtype="variantdate" dt:maxLength="16" rs:fixedlength="true" />
</s:AttributeType>
- <s:AttributeType name="Title" rs:number="3" rs:nullable="true" rs:maydefer="true" rs:writeunknown="true">
<s:datatype dt:type="string" dt:maxLength="40" />
</s:AttributeType>
<s:extends type="rs:rowbase" />
</s:ElementType>
</s:Schema>
- <rs:data>
<z:row Rate="2" RDate="2010-05-01T00:00:00" Title="Adam2" />
<z:row Rate="3" RDate="2010-05-01T00:00:00" Title="Adam3" />
<z:row Rate="4" RDate="2010-05-01T00:00:00" Title="Adam4" />
<z:row Rate="1" RDate="2010-05-01T00:00:00" Title="Adm" />
<z:row Rate="5" RDate="2010-05-01T00:00:00" Title="Eva" />
</rs:data>
</xml>
////////////////////////////////////////////////////////////////////
But i need a simple tree like
<?xml version="1.0" encoding="utf-8" ?>
- <Movies xmlns:xsi=" xmlns:xsd=" <MovieName>sws</MovieName>
<MovieRating>2011-07-30T00:00:00+03:00</MovieRating>
<MovieReleaseDate>223467</MovieReleaseDate>
</Movies>
/////////////////////////////////////////////////////////////////////
Any ideas?!