通用 XML 节点的表示法。
实现类
方法
方法 | 返回类型 | 简介 |
---|---|---|
asCdata() | Cdata | 将节点转换为 CDATASection 节点以进行自动补全。 |
asComment() | Comment | 将节点转换为 Comment 节点以进行自动补全。 |
asDocType() | DocType | 将节点转换为 DocumentType 节点以进行自动补全。 |
asElement() | Element | 将节点转换为 Element 节点以进行自动补全。 |
asEntityRef() | EntityRef | 将节点转换为 EntityReference 节点以进行自动补全。 |
asProcessingInstruction() | ProcessingInstruction | 将节点转换为 ProcessingInstruction 节点以进行自动补全。 |
asText() | Text | 将节点转换为 Text 节点以进行自动补全。 |
detach() | Content | 将节点与其父级 Element 节点分离。 |
getParentElement() | Element | 获取节点的父级 Element 节点。 |
getType() | ContentType | 获取节点的内容类型。 |
getValue() | String | 获取节点的直接或间接子节点的文本值(按照节点在文档中的顺序)。 |
详细文档
asCdata()
asComment()
将节点转换为 Comment
节点以进行自动补全。如果节点的 ContentType
尚未为 COMMENT
,此方法会返回 null
。
返回
asDocType()
将节点转换为 DocumentType
节点以进行自动补全。如果节点的 ContentType
尚未为 DOCTYPE
,此方法会返回 null
。
返回
DocType
- DocumentType
节点
asElement()
asEntityRef()
将节点转换为 EntityReference
节点以进行自动补全。如果节点的 ContentType
尚未为 ENTITYREF
,此方法会返回 null
。
返回
EntityRef
- EntityReference
节点
asProcessingInstruction()
将节点转换为 ProcessingInstruction
节点以进行自动补全。如果节点的 ContentType
尚未为 PROCESSINGINSTRUCTION
,此方法会返回 null
。
返回
ProcessingInstruction
- ProcessingInstruction
节点
asText()
getType()
getValue()
获取节点的直接或间接子节点的文本值(按照节点在文档中的顺序)。
返回
String
- 节点的直接或间接子节点的文本值