🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ast::XMLParser类 参考

#include <XMLParser.hpp>

+ 类 ast::XMLParser 继承关系图:

Public 类型

enum  EToken {
  eError = -1 , eStartDocument , eEndDocument , eStartElement ,
  eEndElement , eCharacters , eComment , eDocTypeDecl ,
  eProcessingInstruction
}
 

Public 成员函数

 XMLParser (StringView filepath)
 
errc_t parse (XMLSax &sax)
 
errc_t parse (XMLNode &node)
 
EToken getNext ()
 
StringView getName () const
 
StringView getText () const
 
StringView getComment () const
 
const XMLSax::AttributeListgetAttributes () const
 
- Public 成员函数 继承自 ast::BaseParser
 BaseParser (StringView filepath)
 
void open (StringView filepath)
 
bool isOpen () const
 
void close ()
 
void seek (std::streamoff pos, std::ios::seekdir dir)
 
std::streamoff tell ()
 
bool eof () const
 
size_t read (void *buffer, size_t size, size_t pos) const
 
size_t read (void *buffer, size_t size) const
 
StringView getLineWithNewline ()
 
StringView getLine ()
 
StringView getLineTrim ()
 
StringView getLineSkipHashComment ()
 
int getLineNumber ()
 
std::string getFilePath () const
 
void setBorrowedFile (FILE *file)
 
void setOwnedFile (FILE *file)
 
FILE * getFile () const
 

Protected 成员函数

void setName (StringView name)
 
void setText (StringView text)
 
void setComment (StringView comment)
 
- Protected 成员函数 继承自 ast::BaseParser
std::vector< char > & getLineBuffer ()
 

详细描述

轻量级的SAX解析器

用于解析XML文档,支持流式解析,无需加载整个文档到内存

成员枚举类型说明

◆ EToken

枚举值
eError 

错误

eStartDocument 

文档开始

eEndDocument 

文档结束

eStartElement 

元素开始

eEndElement 

元素结束

eCharacters 

文本内容

eComment 

注释

eDocTypeDecl 

DOCTYPE声明

eProcessingInstruction 

处理指令

成员函数说明

◆ getAttributes()

const XMLSax::AttributeList & ast::XMLParser::getAttributes ( ) const
inline

获取属性列表

返回
属性列表

◆ getComment()

StringView ast::XMLParser::getComment ( ) const
inline

获取注释

返回
注释

◆ getName()

StringView ast::XMLParser::getName ( ) const
inline

获取元素名称

返回
元素名称

◆ getNext()

XMLParser::EToken ast::XMLParser::getNext ( )

获取下一个解析令牌

返回
下一个解析令牌

◆ getText()

StringView ast::XMLParser::getText ( ) const
inline

获取文本

返回
文本

◆ parse()

errc_t ast::XMLParser::parse ( XMLNode & node)

解析XML文档到节点

参数
node解析结果节点

该类的文档由以下文件生成: