Current location: Hot Scripts Forums » Programming Languages » Visual Basic » VB6 and XML pls help


VB6 and XML pls help

Reply
  #1 (permalink)  
Old 07-21-11, 04:50 AM
ico ico is offline
New Member
 
Join Date: Jul 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
VB6 and XML pls help

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="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MovieName>sws</MovieName>
<MovieRating>2011-07-30T00:00:00+03:00</MovieRating>
<MovieReleaseDate>223467</MovieReleaseDate>
</Movies>
/////////////////////////////////////////////////////////////////////

Any ideas?!
Reply With Quote
  #2 (permalink)  
Old 11-16-11, 03:59 AM
urnspendant urnspendant is offline
New Member
 
Join Date: Nov 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
thanks..for..sharing..
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 01:19 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.