Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 570
  • Last Modified:

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

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
1markmc
Asked:
1markmc
  • 6
  • 4
  • 4
2 Solutions
 
leonstrykerCommented:
You may need to switch to MDAC 2.5, since it is the last one which actually supports Jet.
0
 
1markmcAuthor Commented:
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
 
leonstrykerCommented:
Yes, but "vbModule running in Access " may be the source of your problem
0
Independent Software Vendors: 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!

 
1markmcAuthor Commented:
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
 
leonstrykerCommented:
And yet :"the user and support personnel swear that no new software was installed ".  You never know, till you look.

Leon
0
 
Anthony PerkinsCommented:
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
 
1markmcAuthor Commented:
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
 
Anthony PerkinsCommented:
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
 
1markmcAuthor Commented:
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
 
Anthony PerkinsCommented:
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
 
leonstrykerCommented:
Although, I do not think that this question falls into the "I answered my question myself." category.

Leon
0
 
Anthony PerkinsCommented:
Leon,

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

Anthony
0
 
leonstrykerCommented:
True,

Leon
0
 
leonstrykerCommented:
1markmc,

Thanks for the grade.

Leon
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 6
  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now