返回首页
当前位置: 主页 > 编程语言 > XML教程 >

XML入门 TNoteType Type in XMLIntf.PAS

时间:2015-11-23 21:58来源:电脑教程学习网 www.etwiki.cn 编辑:admin

Description

TNodeType identifies the type of a node in an XML document. The following table lists the possible values:

Value Meaning

ntReserved Not used
ntElement The node represents an element. Element nodes represent simple tags that have child nodes. (Note that sometimes these child nodes do not appear when using IXMLNode. For example child nodes of type ntText are typically hidden by IXMLNode and appear only as the value of the Text property). The child nodes of an element node can have the following node types: ntElement, ntText, ntCData, ntEntityRef, ntProcessingInstr, and ntComment. Element nodes can also have attributes (ntAttribute). Element nodes can be the child of a node of type ntDocument, ntDocFragment, ntEntityRef, and ntElement.

ntAttribute The node represents an attribute of an element. It is not the child of another node, but its value can be accessed using the Attribute property of the element node抯 IXMLNode interface. An attribute node can have child nodes of type ntText and ntEntityRef.
ntText The node represents the text content of a tag. A text node cannot have any child nodes, but can appear as the child node of a node of type ntAttribute, ntDocFragment, ntElement, or ntEntityRef.

ntCData The node represents a CDATA section in the XML source. CDATA sections identify blocks of text that would otherwise be interpreted as markup. An ntCData node can抰 have any child nodes. They can appear as the child of an ntDocFragment, ntEntityRef, or ntElement node.
ntEntityRef The node represents a reference to an entity in the XML document. This can be any type of entity, including character entity references. The children of an entity reference node can be of the following types: ntElement, ntProcessingInstr, ntComment, ntText, ntCData, and ntEntityRef. The entity reference node can appear as the child of an ntAttribute, ntDocFragment, ntElement, or ntEntityRef node.

ntEntity The node represents an expanded entity. Entity nodes can have child nodes that represent the expanded entity (for example, ntText and ntEntityRef nodes). Entity nodes only appear as the child of an ntDocType node.
ntProcessingInstr The node represents a processing instruction (PI) from the XML document. A PI node cannot have any child nodes, but can appear as the child node of a node of type ntDocument, ntDocFragment, ntElement, or ntEntityRef.
ntComment The node represents a comment in the XML document. Comment nodes do not have child nodes. They appear as the child of an ntDocument, ntDocFragment, ntElement, or ntEntityRef node.

ntDocument The node represents a document object, which is the root of the entire XML document. Document nodes have a single ntElement node as a child (the DocumentElement). In addition, they can have child nodes of type ntProcessingInstr, ntComment, and ntDocType. Because the document is the root of the XML document, it never appears as a child node.
ntDocType The node represents the document type declaration, indicated by the <!DOCTYPE > tag. The document type node can child nodes of type ntNotation and ntEntity. It always appears as the child of the document node.

ntDocFragment The node represents a document fragment. A document fragment node associates a node or subtree with a document without actually being contained in the document. Document fragment nodes can have child nodes of type ntElement, ntProcessingInstr, ntComment, ntText, ntCData, and ntEntityRef. It never appears as the child of another node.
ntNotation A node represents a notation in the document type declaration. It always appears as the child of an ntDocType node and never has any child nodes.

以下是我的学习笔记:

entity 实体
processing instruction 处理指令

TNoteType Type in XMLIntf.PAS

·ntReserved 保留
·ntElement 元素结点。Element结点提供单一的有多个子结点的标签(Tag)。
注意,在使用IXMLNote的时候,一些情况下,某些子结点不会出现,
例如,ntText类型的子结点,将被IXMLNote隐藏,而只能通过Text属性来获取数据。
元素结点的子结点可能有以下的类型:
ntElement, ntText, ntCData, ntEntityRef, ntProcessingInstr和ntComment,
Element结点也可以有属性(ntAttribute)。Element结点可以是ntDocument,
ntDocFragment, ntEntityRef, ntElement这些类型的子结点。
·ntAttribute 提供元素属性的结点。这个结点不能作为实际的子结点。
它的值可以通过Element结点IXMLNode接口的Attributes属性来进行访问,
Attribute结点可以有ntText和ntEntityRef类型的子结点。
·ntText 提供标签的文本内容,Text结点不能有子结点。
可以作为ntAttribute, ntDocFragment, ntElement或ntEntityRef的子结点。
·ntCData 结点在XML源提供一个CDATA节。CDATA表示的是作为备注的文本块。
ntCData类型的结点不能有子结点。可以作为ntDocFragment, ntEntityRef或
ntElement类型的子结点。
·ntEntityRef 在XML文档中,提供[实体引用]结点。这种结点可以是实体类型,
也可以是包含实体表述的字符串。ntEntityRef可以带有如下的子结点:
ntElement, ntProcessingInstr, ntComment, ntText, ntCData和ntEntityRef.
ntEntityRef可以作为以下类型的子结点:ntAttribute, ntDocFragment,
ntElement,或ntEntityRef。
·ntEntity 提供[扩展实体]结点,ntEntity结点可以有描述扩展实体的子结点
(例如ntText和ntEntityRef类型的结点)。ntEntity仅作为ntDocType结点的子结点出现。
·ntProcessingInstr 结点为XML文档提供处理指令(PI)。PI结点不能有子结点,
可以作为ntDocument, ntDocFragment, ntElement,或ntEntityRef类型的子结点。
·ntComment 提供XML文档的注释。ntComment不能有子结点,可以作为ntDocument,
ntDocFragment, ntElement,或ntEntityRef结点的子结点。
·ntDocument 提供XML文档对象结点,也就是整个XML文档的根结点,
ntDocument只有一个ntElement子结点(DocumentElement)。
此外,还可以有以下类型的子结点ntProcessingInstr, ntComment,和ntDocType。
因为这个结点是XML文档的根结点,所以它不能作为子结点出现。
·ntDocType 结点通过<!DOCTYPE >来实现文档的类型声明。
ntDocType可以有ntNotation 和 ntEntity类型的子结点。
ntDocType结点通常作为ntDocument的子结点。
·ntDocFragment 结点描述文档碎片。ntDocFragment关联一个并没有在文档中
实际关联的结点或者子树。ntDocFragment可以有如下类型的子结点:ntElement,
ntProcessingInstr,ntComment,ntText,ntCData和ntEntityRef。
它不能作为其他任何结点的子结点。
·ntNotation 提供文档类型声明。一般作为ntDocType结点的子结点,且不能有子结点。

整理一下上面的学习内容:

基本元素:元素(ntElement),实体链接(ntEntityRef),属性(ntAttribute)。
基本结构:文档(ntDocument),文档碎片(ntDocFragment)。

格式:+代表可以循环,
#表述 代表根结点或者父结点唯一固定
表述# 代表终端结点。

除了文档之外的,每个都有的:
ntText# 属性值(对于ntAttribute)/名称(其他所有)
ntComment# 注释
无关紧要的:
ntCData# 备注

ntElement //元素
ntElement+ //元素
ntText# //元素名称
ntCData# //备注
ntComment# //注释
ntProcessingInstr# //处理指令
ntEntityRef+ //实体链接

ntEntityRef //实体链接
ntElement+ //元素
ntText# //元素名称
ntCData# //备注
ntCommnent# //注释
ntProcessingInstr# //处理指令
ntEntityRef+ //实体链接

#ntAttribute //属性
ntText# //属性值
ntEntityRef+ //实体链接

#ntDocument //文档
[DocumentElement](ntElement) //根目录
ntComment# //注释
ntProcessingInStr# //处理指令
ntDocType //文档类型
ntNotation# //文档类型属性
ntEntity //实体
ntText# //名称
ntEntityRef+ //实体链接

#ntDocFragment //文档 碎片 片断
ntElement+ //元素
ntText# //名称
ntCData# //备注
ntComment# //注释
ntProcessingInstr# //处理指令
ntEntityRef+ //实体链接

 

------分隔线----------------------------
标签(Tag):xml
------分隔线----------------------------
推荐内容
猜你感兴趣