Comment

Comment

概述

Comment 是 Aspose.Html FOSS 中用于 Python 的类。继承自:CharacterData。

一个 HTML 注释节点。

此类提供 29 个用于在 Python 程序中处理 Comment 对象的方法。可用的方法包括:__init__、add_event_listener、append_child、append_data、clone_node、compare_document_position、contains、delete_data、dispatch_event、get_feature、get_root_node、get_user_data,以及另外 17 个方法。安装 Aspose.Html FOSS for Python 包后,所有公共成员对任何 Python 应用程序均可访问。属性:child_nodes、data、first_child、is_connected、last_child、length,以及另外 9 项。

属性

名称类型访问描述
node_namestr读取'#comment'
node_valuestr读写字符数据内容(与 data 相同)。
text_content`strNone`读写
datastr读写字符数据内容。
lengthint读取data 中的代码单元数。
node_typeint读取来自 NodeType 的整数节点类型常量。
parent_node`NodeNone`读取
parent_element`ElementNone`读取
is_connectedbool读取此节点是否属于文档的节点树(WHATWG DOM §4.4)。
owner_document`DocumentNone`读取
child_nodesNodeList读取所有子节点的实时 NodeList。
first_child`NodeNone`读取
last_child`NodeNone`读取
previous_sibling`NodeNone`读取
next_sibling`NodeNone`读取

方法

签名描述
`init(data: str, owner_document: DocumentNone)`
substring_data(offset: int, count: int) → str返回子字符串 data 从…开始 offset for count 字符。
append_data(data: str)Append data 到现有的字符数据。
insert_data(offset: int, data: str)Insert data at offset.
delete_data(offset: int, count: int)Delete count 字符起始于 offset.
replace_data(offset: int, count: int, data: str)Replace count 字符从 offset with data.
remove()从其父节点中移除此节点。
get_root_node(composed: bool) → "Node"返回该节点树的根节点。
has_child_nodes() → bool返回此节点是否至少拥有一个直接子节点。
`lookup_namespace_uri(prefix: strNone)→str
`lookup_prefix(namespace_uri: strNone)→str
`is_default_namespace(namespace_uri: strNone)→bool`
`is_supported(feature: str, version: strNone)→bool`
`get_feature(feature: str, version: strNone)→object
`set_user_data(key: str, data: objectNone, handler: object
get_user_data(key: str) → `objectNone`
append_child(node: Node) → NodeAppend node 作为此节点的最后一个子节点。
`insert_before(node: Node, reference: NodeNone)→Node`
remove_child(node: Node) → NodeRemove node 从子列表中获取并返回它。
replace_child(new_child: Node, old_child: Node) → NodeReplace old_child with new_child.
clone_node(deep: bool) → Node返回此节点的副本。
normalize()将此节点及其整个子树转换为标准化形式。
`contains(other: NodeNone)→bool`
compare_document_position(other: "Node") → int返回描述位置的位掩码 other 相对于此节点。
`is_equal_node(other: NodeNone)→bool`
`is_same_node(other_node: NodeNone)→bool`
add_event_listener(type: str, listener: Callable, capture: bool, once: bool)Register listener 用于事件的 type.
remove_event_listener(type: str, listener: Callable, capture: bool)注销先前已注册的监听器。
dispatch_event(event: "Event") → boolDispatch event 通过祖先树。

另请参阅

 中文