• 您的位置我爱Aspx >> VC.Net >> vc++中使用xml
  • vc++中使用xml

  • 作者:aspxer  来源:internet  日期:2007-5-21 23:49:13  关键字:xml
  • Using the Import Directive

    All the samples in this article use the #import directive to de-compile the IE5 type library into useable C++ classes and smart pointers. This directive is part of what´s known as the native COM compiler support. I´ve chosen to write the samples using this approach for several reasons. It is simple to use, helps to clearly demonstrate the usage of the IE5 objects without complicating the code, and ?most importantly ?it doesn´t require you to go through the somewhat painful process of trying to get the latest SDK header files before you start.

    Lets start by taking a look at the import directive that creates the C++ wrapper classes for the IE5 object model:

    #import "msxml.dll" rename_namespace("xml")

    The most obvious point here is that the type library for IE5 is contained within MSXML.DLL. As this is located in the windows system directory, I´ve not had to specify a full path. The rename_namespace attribute defines all of the created wrapper classes in a C++ namespace called xml. This is good because it prevents possible conflicts with existing include files you might have on your system, but does mean that everything must be prefixed with a namespace qualifier. So, for the interface IXMLDOMDocument (which will be discussed later) we have to explicitly specify the namespace like this: xml::IXMLDOMDocument. I personally quite like this syntax, but if you dislike namespaces or simply don´t want to use them, try using the no_namespace attribute.

    我对这篇文章有话说?
  • 广告位招租,广告代号:content_468_15
  • 上一篇:vc++中使用xml
    下一篇:异步调用win32 internet functions