MsXml DOM对象与接口
来源:互联网 发布:智能马桶盖清洗 知乎 编辑:程序博客网 时间:2024/05/19 08:44
This part of the XML Document Object Model (DOM) reference describes the programming object syntax. The first table lists the core objects/interfaces. The second table lists the implemented objects/interfaces.
XML DOM Core Objects/Interfaces
The following objects/interfaces represent implementations of the XML DOM core objects/interfaces. The objects/interfaces include Microsoft extensions to support the following items and operations: namespaces, data types, XML schemas, Extensible Stylesheet Language (XSL), XSL Transformations (XSLT) operations, asynchronous loading, and the saving of documents.
IXMLDOMDocument/DOMDocument
Represents the top node of the XML DOM tree.
IXMLDOMDocument2
An extension of DOMDocument. This extension supports schema caching and runtime validation, and provides a way to switch on XML Path Language (XPath) support.
IXMLDOMNamedNodeMap
Enables iteration and access, by name, to the collection of attributes. IXMLDOMNamedNodeMapincludes support for namespaces.
IXMLDOMNode
Represents a single node in the document tree. IXMLDOMNode is the base interface for accessing data in the XML object model. This interface includes support for data types, namespaces, document type definitions (DTDs), and XML schemas.
IXMLDOMNodeList
Enables iteration and indexed access operations on the live collection of IXMLDOMNode.
IXMLDOMParseError
Returns detailed information about the last error, including the error number, the line number, the character position, and a text description.
IXMLHTTPRequest
Provides client-side protocol support for communication with HTTP servers.
在VC程序中,导入MsXml4解析器代码如下:
#import <msxml4.dll> // C:/WINDOWS/system32/msxml4.dll
using namespace MSXML2;
以上自动方式导入msxml4.dll,编译后将会在工程目录下的debug/release文件夹下生成头文件msxml4.tlh和实现文件msxml4.tli。
msxml4.tli : Typelib Generated C/C++ Inline File
// compiler-generated
// Wrapper implementations for Win32 type library msxml4.dll
msxml4.tlh : Typelib Generated C/C++ Header
// compiler-generated file
// C++ source equivalent of Win32 type library msxml4.dll
关于接口的声明参考msxml4.tlh文件,以下为MsXml Parser中主要接口示意图。关于各接口的详细说明及使用示例,请参考MSDN。
MSXML DOM Objects/Interfaces示意图
IXMLDOMDocument的属性和方法除继承IXMLDOMNode外,有以下重要扩充:
VARIANT_BOOL load (const _variant_t & xmlSource ); // 从指定路径加载xml文档
VARIANT_BOOL loadXML (_bstr_t bstrXML ); // 加载具有xml格式的字符串
HRESULT save (const _variant_t & destination ); // 将xml文档保存到指定路径
// 获取指定名称的节点(集),类似IXMLDOMNode.selectNodes
IXMLDOMNodeListPtr getElementsByTagName (_bstr_t tagName );
// 以下为访存根节点元素documentElement的接口
IXMLDOMElementPtr GetdocumentElement ( );
void PutRefdocumentElement ( struct IXMLDOMElement * DOMElement );
// 以下为创建节点元素的接口
IXMLDOMElementPtr createElement ( _bstr_t tagName );
IXMLDOMTextPtr createTextNode ( _bstr_t data );
IXMLDOMCommentPtr createComment (_bstr_t data );
IXMLDOMAttributePtr createAttribute ( _bstr_t name );
IXMLDOMNodePtr createNode ( const _variant_t & type,
_bstr_t name,
_bstr_t namespaceURI );
继承自IXMLDOMNode的其他重要接口如下:
(1)IXMLDOMDocument:代表整个XML文档——切皆为节点!
(2)IXMLDOMProcessingInstruction:XML文档声明,包括version属性,encoding属性和encoding属性。
(3)IXMLDOMElement:代表节点元素。
(4)IXMLDOMAttribute:代表节点属性,属性本身也是节点。
(5)IXMLDOMComment:代表注释节点。此为二级继承接口。
参考:
http://msdn.microsoft.com/en-us/library/ms760218(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms761386(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms767664(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms767713(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms757878(VS.85).aspx
- MsXml DOM对象与接口
- DOM and MSXML
- msxml dom 全解析
- msxml dom 全解析
- msxml dom 全解析
- msxml dom 全解析
- msXML DOM操作XML文档
- jquery与dom对象
- Window对象与DOM
- Dom对象与Jquery对象
- jQuery对象与DOM对象
- jQuery对象与dom对象
- jquery 对象 与dom对象
- JQuery对象与DOM对象
- Dom对象与Jquery对象
- jquery对象与DOM对象
- jquery对象与DOM对象
- jQuery对象与DOM对象
- Understanding The Laser Engraver
- (转)20年嵌入式领域开发经验精华三
- 求解Matlab微分方程组中的时移问题!!!
- symbian ui框架设计
- (转)20年嵌入式领域开发经验精华四
- MsXml DOM对象与接口
- 请张东健代言,搞寻宝乐园送钱,法派真牛!
- ieBook超级精灵2008 专业版破解下载+周边素材和软件
- (转)20年嵌入式领域开发经验精华五
- 虚拟机问题
- 创建模式之三:生成器方法(Builder)
- cin、cin.get()、cin.getline()、getline()、gets()等函数的用法
- (转)20年嵌入式领域开发经验精华六
- 开源Open CASCADE