Solved

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

Posted on 2003-11-03
14
553 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
  • 6
  • 4
  • 4
14 Comments
 
LVL 29

Expert Comment

by:leonstryker
Comment Utility
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
Comment Utility
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
Comment Utility
Yes, but "vbModule running in Access " may be the source of your problem
0
 
LVL 1

Author Comment

by:1markmc
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
True,

Leon
0
 
LVL 29

Expert Comment

by:leonstryker
Comment Utility
1markmc,

Thanks for the grade.

Leon
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

771 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now