Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/251246

From BetaArchive Wiki

Article ID: 251246

Article Last Modified on 10/13/2001


  • Microsoft Internet Explorer 5.0
  • Microsoft XML Parser 2.0
  • Microsoft XML Parser 2.5
  • Microsoft XML Parser 2.6
  • Microsoft XML Core Services 4.0
  • Microsoft XML Core Services 4.0

This article was previously published under Q251246


If you create an XML document in one process, pass that XMLDOMDocument to another process (say, for example, an Microsoft Transaction Server component), and try to create a new XML DOMDocument using a node or element from the first XML document, you will receive this error message:

Run Time Error -2147024809 (80070057) The parameter is incorrect.


Instead of creating the XML DOMDocuments in separate processes, you can create both XML DOMDocuments in one process, and then pass them as parameters into your Microsoft Transaction Server component.

For example, if you are using Microsoft Visual Basic, instead of having:

Public Function GetNode(xmlDoc as MSXML.DOMDocument) as MSXML.DOMDocument

you could have:

Public Sub GetNode(xmlDoc as MSXML.DOMDocument, xmlReturn as MSXML.DOMDocument)


This behavior is by design.


Steps to Reproduce Behavior

  1. Create a new Visual Basic Standard EXE project.
  2. Add a reference to Microsoft XML, version 2.
  3. Add a command button to the form1.
  4. Paste the following code into Command1's click event:

        Dim xmlDoc As New MSXML.DOMDocument
        Dim xmlReturnedDoc As MSXML.DOMDocument
        Dim obj As XMLTest.TestObject
        Set obj = CreateObject("XMLTEST.TestObject")
        xmlDoc.Load "C:\my.xml"
        set xmlReturnedDoc = obj.GetNode(xmlDoc) "C:\output.xml"
        Set obj = Nothing
        Set xmlDoc = Nothing
        Set xmlReturnedDoc = Nothing
  5. Note that you must change the xmlDoc.Load and paths to point to an appropriate location for the XML test files on your drive.
  6. Create the file C:\My.xml, and then paste the following XML into it:

        <symbol>AWG A0-FX</symbol>
        <country>Aruba Guilder</country>
        <symbol>CRC A0-FX</symbol>
        <country>Costa Rica Colones</country>
        <symbol>HTG A0-FX</symbol>
        <country>Haiti Gourde</country>
        <symbol>PAB A0-FX</symbol>
        <country>Panama Balboa</country>
  7. Add a new Microsoft ActiveX DLL project to your Visual Basic session, creating a project group. Name the project XMLTest, and name the class module that is created by default as TestObject.
  8. Paste the following code into TestObject:

    Public Function GetNode(x As MSXML.DOMDocument) as MSXML.DomDocument
        Dim xmlDoc As MSXML.DOMDocument
        Dim xmlNode As MSXML.IXMLDOMNode
        Dim pi As MSXML.IXMLDOMProcessingInstruction
        Set xmlDoc = New MSXML.DOMDocument
        Set pi = xmlDoc.createProcessingInstruction("xml", " version=""1.0""")
        xmlDoc.insertBefore pi, xmlDoc.childNodes.Item(0)
        'Clone the benefit node from the request XML.
        Set xmlNode = x.selectSingleNode("//currency").cloneNode(True)
        xmlDoc.appendChild xmlNode
        'Return the XML.
        Set GetNode = xmlDoc
        'Clean up objects.
        Set xmlDoc = Nothing
        Set xmlNode = Nothing
        Set pi = Nothing
    End Function
  9. Compile the .dll and the .exe files.
  10. Add a reference to the XMLTestProject.exe for XMLTest.
  11. Run XMLTestProject.exe. Because the .dll file is pulled into the .exe's space, the XMLDocuments are created in the same process: You should not get any errors.
  12. Import the .dll file into Microsoft Transaction Server.
  13. Run XMLTestProject.exe. It should fail with the error "Run Time Error -2147024809 (80070057) The parameter is incorrect."

If a newer version of MSXML has been installed in side-by-side mode, you must explicitly use the Globally Unique Identifiers (GUIDs) or ProgIDs for that version to run the sample code. For example, MSXML version 4.0 can only be installed in side-by-side mode. For additional information about the code changes that are required to run the sample code with the MSXML 4.0 parser, click the following article number to view the article in the Microsoft Knowledge Base:

305019 INFO: MSXML 4.0 Specific GUIDs and ProgIds

Keywords: kbprb KB251246