Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML From VB 1

Status
Not open for further replies.

Skittle

ISP
Joined
Sep 10, 2002
Messages
1,528
Location
US
Following an example from a book, have just created an XML file from a VB recordset using the following command:-

MyRecordSet.Save "C:\MyFile.XML", adPersistXML

The XML file can be opened with notepad.
The book says 'Dont be alarmed at how different it looks from the XML files you have seen until now'.
The problem is that although I can load this XML file into a browser or Excel, it does look VERY different to the XML examples I have encountered.

Can anybody exlain why it is so different to the standard XML that the books use to teach? Is it a Microsoft thing?
I've noticed the same thing happens if I save from an Excel sheet. A format of XML is created that looks very different to the type I have encountered in my self teaching to date.


<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='ID' rs:number='1'
rs:maydefer='true' rs:writeunknown='true'>
<s:datatype dt:type='int' dt:maxLength='4'
rs:precision='10' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='strName' rs:number='2'
rs:nullable='true' rs:maydefer='true'
rs:writeunknown='true'>
<s:datatype dt:type='string'
dt:maxLength='50'/>
</s:AttributeType>
<s:AttributeType name='lngNumber'
rs:number='3' rs:nullable='true'
rs:maydefer='true' rs:writeunknown='true'>
<s:datatype dt:type='int' dt:maxLength='4'
rs:precision='10' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='strType' rs:number='4'
rs:nullable='true' rs:maydefer='true'
rs:writeunknown='true'>
<s:datatype dt:type='string' dt:maxLength='1'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>

<rs:data>
<z:row ID='4' strName='Alpha' lngNumber='17'
strType='1'/>
<z:row ID='6' strName='Beta' lngNumber='12'
strType='2'/>
<z:row ID='7' strName='Tom' lngNumber='11'
strType='1'/>
<z:row ID='8' strName='Arthur' lngNumber='9'
strType='3'/>
<z:row ID='9' strName='Susan' lngNumber='10'
strType='1'/>
<z:row ID='10' strName='Jilly' lngNumber='12'
strType='2'/>
<z:row ID='11' strName='wendydgdfg' lngNumber='13'
strType='4'/>
<z:row ID='12' strName='Harrison' lngNumber='14'
strType='1'/>
</rs:data>
</xml>



Dazed and confused
 
When you persist a recordset to an XML file, it also includes information about the structure of the recordset -- the stuff you're seeing at the top of the file.

All you really care about is the part starting with the <rs:data> element, unless there's some reason for your program to dynamically configure itself to the structure of the data.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top