Solved

XML Parser Error When attempting to open XML file with ADO object

Posted on 2003-11-03
14
562 Views
Last Modified: 2013-11-23
I have a vbModule running in Access which attempts to "rehydrate" a recordset that has been persisted as an XML file.  The code has worked fine for several months on 20 or so windows 2000 computers and one XP computer.   It recently stopped working on the XP machine (the user and support personnel swear that no new software was installed before it quit working but I am not convinced - at any rate I don't have any control over that).  

I have limited access to the errant computer so when I get access to it I need to have high confidence that the fix I have in mind will work.

My question is:  What components need to be reinstalled to get the application running again?

Here are some specifics:

The exact error message is:
Persisted XML files cannot be opened with the version of the Microsoft XML Parser currently installed on this computer.  Upgrade your system through a windows 95/98 service release or Internet Explorer 5.0 or later.

The code that results in the error:

public function HydrateRecordset(ByVal strXDR as String) as ADODB.Recordset

    Dim stm as ADODB.Stream
   
    Set stm = New ADODB.Stream

    With stm
        .Open
        .WriteText strXDR
        .Position = 0
    End With

    Set HydrateRecordset = New ADODB.Recordset
    HydrateRecordset.Open stm  '<<ERROR HAPPENS HERE>>

End Function

The contents of the xml file were created using this function.

Public Function DehydrateRecordset (ByRef rst as ADODB.Recordset) as string
    Dim stm as ADODB.Stream
   
    Set stm = new ADODB.Stream
    rst.Save stm, adPersistXML
    stm.Position = 0
    DehydrateRecordset = stm.ReadText()

End Function

The program references Microsoft ActiveXData Objects 2.7 library
0
Comment
Question by:1markmc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 4
14 Comments
 
LVL 29

Expert Comment

by:leonstryker
ID: 9673268
You may need to switch to MDAC 2.5, since it is the last one which actually supports Jet.
0
 
LVL 1

Author Comment

by:1markmc
ID: 9673413
Thanks for the comment.

However the code in question is not accessing the jet database it is only attempting to rehydrate a recordset that was ultimately created from SQL Server and then persisted as an XML file.
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9673429
Yes, but "vbModule running in Access " may be the source of your problem
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:1markmc
ID: 9673517
Good point.  However the code worked for several months prior to the recent issue and continues to work using MDAC 2.7 on Windows 2000 computers.
0
 
LVL 29

Assisted Solution

by:leonstryker
leonstryker earned 250 total points
ID: 9673683
And yet :"the user and support personnel swear that no new software was installed ".  You never know, till you look.

Leon
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 250 total points
ID: 9674313
Any chance you can post the contents of "strXDR" on this particular box.  From the error, I would have to differ with Leon, that it is related to JET.  Although I agree with him, that users invariable suffer "amnesia".

Anthony
0
 
LVL 1

Author Comment

by:1markmc
ID: 9674860
Here is the contents of strXDR.  In this particular case it is a file that has just been created to store a recordset.  The error happens with this file anyway.  Also when trying to retrieve an existing recordset I get the same error -- as long as I am on the XP machine.

When I an existing xml file off the xp machine to another computer (in this case a win2000 machine) that same file works.  



<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'
     rs:updatable='true' rs:ReshapeName='DSRowset1'>
        <s:AttributeType name='DatasourceGUID' rs:number='1'
             rs:nullable='true' rs:write='true' rs:calculation='00'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='38'/>
        </s:AttributeType>
        <s:AttributeType name='ServerInstance' rs:number='2'
             rs:nullable='true' rs:write='true' rs:calculation='00'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='40'/>
        </s:AttributeType>
        <s:AttributeType name='DatabaseName' rs:number='3' rs:nullable='true'
             rs:write='true' rs:calculation='00'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='128'/>
        </s:AttributeType>
        <s:AttributeType name='NetworkProtocol' rs:number='4'
             rs:nullable='true' rs:write='true' rs:calculation='00'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='20'/>
        </s:AttributeType>
        <s:AttributeType name='NetworkAddress' rs:number='5'
             rs:nullable='true' rs:write='true' rs:calculation='00'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='128'/>
        </s:AttributeType>
        <s:AttributeType name='Packetsize' rs:number='6' rs:nullable='true'
             rs:write='true' rs:calculation='00'>
            <s:datatype dt:type='int' dt:maxLength='4' rs:fixedlength='true'/>
        </s:AttributeType>
        <s:AttributeType name='UserName' rs:number='7' rs:nullable='true'
             rs:write='true' rs:calculation='00'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='50'/>
        </s:AttributeType>
        <s:AttributeType name='Password' rs:number='8' rs:nullable='true'
             rs:write='true' rs:calculation='00'>
            <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='50'/>
        </s:AttributeType>
        <s:AttributeType name='ConnectionTimeout' rs:number='9'
             rs:nullable='true' rs:write='true' rs:calculation='00'>
            <s:datatype dt:type='int' dt:maxLength='4' rs:fixedlength='true'/>
        </s:AttributeType>
        <s:extends type='rs:rowbase'/>
    </s:ElementType>
</s:Schema>
<rs:data>
    <z:row DatasourceGUID='{2D84FBAC-E2B6-4DDF-BC69-4A0A559DBCC9}'/>
</rs:data>
</xml>

0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 9675017
I do not believe that error message is generated by MSXML or MDAC, but rather it is a custom error message.

I realize this is a pain, but if you could modify your code or create a standalone program that includes error handling it may be a little easier to troubleshoot.  Something like (untested):

public function HydrateRecordset(ByVal strXDR as String) as ADODB.Recordset

    Dim stm as ADODB.Stream
   
    On Error GoTo ErrHandler

    'Try loading in an xml document first
    Dim XMLDoc As MSXML2.DOMDocument
    Set XMLDoc = New MSXML2.DOMDocument
    If Not XMLDoc.LoadXML strXDR
        MsgBox XMLDoc.ParseError.Reason
    End If
    Set XMLDoc = Nothing

    Set stm = New ADODB.Stream

    With stm
        .Open
        .WriteText strXDR
        .Position = 0
    End With

    Set HydrateRecordset = New ADODB.Recordset
    HydrateRecordset.Open stm  '<<ERROR HAPPENS HERE>>

    Exit Function
    ErrHandler:
    MsgBox Err.Description

End Function

Anthony
0
 
LVL 1

Author Comment

by:1markmc
ID: 9739788
OK I found the answer.  

The user had DAO 3.0 installed and I uninstalled that.  I then reinstalled MDAC 2.7 and the application worked fine again.  

It appears that the message was indeed coming from the XML parser iteslf and was not a custom error message.  

0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 9739927
Then please go ahead and close the question.  See here:
I answered my question myself. What do I do?
http://www.experts-exchange.com/help/closing.jsp#4

Thanks,
Anthony
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9740572
Although, I do not think that this question falls into the "I answered my question myself." category.

Leon
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 9740677
Leon,

I don't either for a second, but my aim was to get this question closed and move on.

Anthony
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9740694
True,

Leon
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9790499
1markmc,

Thanks for the grade.

Leon
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question