Click to return to the XML (Extensible Markup Language) home page    
Instantiating the XML Con...     Getting the XML Data     Using XML on the Server    
Web Workshop  |  XML (Extensible Markup Language)

Choosing a Threading Model


There are two versions of the XML control: a version with a rental model and a version with a free-threaded model. The rental model version is designed for single-threaded access. The free-threaded version is designed for multiple thread access.

The two versions are distinguished by their progIDs. To use the rental model control, use the "Microsoft.XMLDOM" progID. To use the free-threaded control, use the "Microsoft.FreeThreadedXMLDOM" progID.

If you plan for several threads to access your XML data from a single control, be sure to use the free-threaded control. If only one thread will access the XML data, use the rental model control since it will perform better.

The following is a sample global.asa file that creates session-level and application-level free-threaded versions of the XML control.

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
  Sub Session_OnStart

    ON error RESUME next
     
    SET Application("AppFXMLdoc") = _
      server.CreateObject("Microsoft.FreeThreadedXMLDOM")
    SET Session("SessFXMLdoc") = _
      server.CreateObject("Microsoft.FreeThreadedXMLDOM")

  End Sub

  Sub Session_OnEnd

    ON error RESUME next
      
    SET Session("SessFXMLdoc") = nothing
    SET Application("AppFXMLdoc") = nothing

    Session("SessFXMLdoc") = empty
    Application("AppFXMLdoc") = empty

  End Sub
</SCRIPT>

Scripts accessing the Session and Application objects will be able to simultaneously access the "AppFXMLdoc" and "SessFXMLdoc" objects.



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.