xml::XmlReader 类
XmlReader 抽象类。
总结
成员 | 说明 |
---|---|
public bool Read() | 读取元素的下一个节点。 |
public XmlNodeType GetNodeType() const | 获取当前节点类型。 |
public std::string GetName() const | 如果找到则返回名称,否则返回异常。 可以使用空名称。 |
public bool GetName(std::string& name) const | 如果找到名称则返回。 只有在为 True 时设置名称。 可以使用空名称。 |
public bool Skip() | 跳过当前节点,直到找到一个非空节点。 |
public bool GetValue(std::string& value) const | 如果找到值则返回。 只有在为 True 时设置值。 可以使用空值。 |
public std::string GetAncestors() const | 返回当前上级节点(用于调试文本),用于以下用途 <node grand parent attributes=...>><node parent><node> 。 |
public bool IsEmptyElement() const | 返回当前节点是否为空元素。 |
public bool GetAttribute(const std::string& attributeName, std::string& attribute) const | 如果找到属性,则返回 True。 只有在为 True 时设置属性。 可以使用空属性。 |
public bool HasAttributes() const | 返回当前节点是否有属性。 |
public bool MoveToFirstAttribute() | 移动到第一个属性。 |
public bool MoveToNextAttribute() | Move to Next 属性。 |
public bool MoveToElement() | 从属性移动到元素。 |
public std::string DumpNode() | 方法以未修改的方式从原始 xml 返回所有节点元素。 |
成员
Read 函数
读取元素的下一个节点。 失败时引发 XmlParserException
返回结果:如果成功读取节点,则为 True。
GetNodeType 函数
获取当前节点类型。
返回结果:Xml 读取器节点类型。
GetName 函数
如果找到则返回名称,否则返回异常。 可以使用空名称。 失败时引发 XmlParserException
返回结果:节点名称。
GetName 函数
如果找到名称则返回。 只有在为 True 时设置名称。 可以使用空名称。
返回结果:节点名称。
Skip 函数
跳过当前节点,直到找到一个非空节点。 失败时引发 XmlParserException
返回结果:如果名称成功,则为 True。
GetValue 函数
如果找到值则返回。 只有在为 True 时设置值。 可以使用空值。
参数:
- value:输出值
返回结果:如果值存在则为 True,否则为 False。
GetAncestors 函数
返回当前上级节点(用于调试文本),用于以下用途 <node grand parent attributes=...>><node parent><node>
。
用于调试目的和错误记录。
IsEmptyElement 函数
返回当前节点是否为空元素。 失败时引发 XmlParserException
返回结果:如果元素为空,则返回 True。
GetAttribute 函数
如果找到属性,则返回 True。 只有在为 True 时设置属性。 可以使用空属性。
参数:
attributeName:属性名称。
attribute:属性值。
返回结果:如果成功则为 True
HasAttributes 函数
返回当前节点是否有属性。 失败时引发 XmlParserException
返回结果:如果当前节点具有属性,则为 True。
MoveToFirstAttribute 函数
移动到第一个属性。 失败时引发 XmlParserException
返回结果:如果成功则为 True
MoveToNextAttribute 函数
Move to Next 属性。 失败时引发 XmlParserException
返回结果:如果成功则为 True
MoveToElement 函数
从属性移动到元素。 失败时引发 XmlParserException
返回结果:如果成功则为 True
DumpNode 函数
方法以未修改的方式从原始 xml 返回所有节点元素。 失败时引发 XmlParserException
返回结果:整个序列化元素。 已移动到节点的末尾。