views:

27

answers:

2

I need to Convert my XML Data to an ADO RecordSet. I am able to construct the ADO Persistant XML format for the conversion but I am not too sure why the single row in my XML is being ignored. The final recordset produced has EOF and BOF both as true, and RecordCount is 0 but that is incorrect since my XML does contain at one row as in the XMl below. Any idea what I may have wrong in this please?

<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='AddressObject' content='eltOnly'>
        <s:AttributeType  name='ADDRESSKEY'  rs:number='1'  />
        <s:AttributeType  name='ADDRESS_1'  rs:number='2'  />
        <s:AttributeType  name='ADDRESS_2'  rs:number='3'  />
        <s:AttributeType  name='ADDRESS_3'  rs:number='4'  />
        <s:AttributeType  name='CITY'  rs:number='5'  />
        <s:AttributeType  name='STATE'  rs:number='6'  />
        <s:AttributeType  name='ZIP'  rs:number='7'  />
        <s:AttributeType  name='FULLADDRESS'  rs:number='8'  />
        <s:AttributeType  name='COUNTRY'  rs:number='9'  />
        <s:AttributeType  name='FULLADDRESS2'  rs:number='10'  />
        <s:AttributeType  name='COUNTY'  rs:number='11'  />
        <s:AttributeType  name='BADADDRESS'  rs:number='12'  />
        <s:AttributeType  name='VALIDADDRESS'  rs:number='13'  />
        <s:AttributeType  name='OWNERID'  rs:number='14'  />
        <s:extends type='rs:rowbase'/>
    </s:ElementType>
</s:Schema>
<rs:data>
    <z:row ADDRESSKEY='2bbcd09f-89c7-1242-93bb-ce23e832ab94' ADDRESS_1='123 Broad Lane' ADDRESS_2='' ADDRESS_3='' CITY='Forest Lake' STATE='TX' ZIP='78133' FULLADDRESS='Canyon Lake, TX  78123' COUNTRY='UNITED STATES' FULLADDRESS2='' COUNTY='Lola' BADADDRESS='0' VALIDADDRESS='0' OWNERID='001049231' />
</rs:data>
</xml>

Here is a Sample of a correct ADO Persistent XML Format

<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' rs:CommandTimeout='30'> 
<s:AttributeType name='name' rs:number='1' > 
<s:datatype dt:type='string' dt:maxLength='10' /> 
</s:AttributeType> 
<s:AttributeType name='bin' rs:number='2' > 
<s:datatype dt:type='bin.hex' dt:maxLength='8' /> 
</s:AttributeType> 
<s:AttributeType name='GUID' rs:number='3'> 
<s:datatype dt:type='uuid' dt:maxLength='16' /> 
</s:AttributeType> 
<s:AttributeType name='date' rs:number='4' > 
<s:datatype dt:type='dateTime' dt:maxLength='16' 
rs:scale='0' rs:precision='16' /> 
</s:AttributeType> 
<s:AttributeType name='float' rs:number='6' > 
<s:datatype dt:type='float' dt:maxLength='8'rs:precision='15' /> 
</s:AttributeType> 
<s:AttributeType name='flag' rs:number='7' > 
<s:datatype dt:type='boolean' dt:maxLength='2' /> 
</s:AttributeType> 
</s:ElementType> 
</s:Schema> 
<rs:data> 
<z:row name='sample1' bin='00000000499602d2' 
GUID='{8AC68D3D-8A09-4403-8860-D0E494BBE894}' 
date='2008-01-25T13:04:00Z' 
float='3.1415926535800001' flag='0'/> 
<z:row name='sample2' date='2008-02-13T18:49:00Z' flag='1'/> 
</rs:data> 
</xml>

From the Link

http://msdn.microsoft.com/en-us/library/cc313112(v=office.12).aspx

A: 

If it really has <xml> as the top-level element, try renaming that element. Names beginning with "xml" are not allowed, so your XML is not well-formed. An XML processor worth its salt will reject it.

LarsH
A: 

Try changing this line

<s:ElementType name='AddressObject' content='eltOnly'>

to

<s:ElementType name='row' content='eltOnly'>
Garett
Thanks a whole bunch! That was it!
Kobojunkie