RTU_ALL_AI/docs/public/libxml/API-libxml.md

25 lines
923 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# API-libxml — XML 解析模块
> C 接口包装 tinyxml2供 libdatacenter 等模块调用。
## 接口
| 函数 | 说明 |
|------|------|
| `myXml_load_file(path)` | 从文件加载 XML返回不透明文档句柄 |
| `myXml_new_doc(root_name)` | 新建空 XML 文档 |
| `myXml_free_doc(doc)` | 释放文档 |
| `myXml_root_elem(doc)` | 获取根元素 |
| `myXml_save_file(doc, path)` | 保存到文件 |
| `myXml_first_child(parent, name)` | 查找第一个匹配子元素 |
| `myXml_next_sibling(elem, name)` | 查找下一个匹配兄弟元素 |
| `myXml_attr_str(elem, name, def)` | 获取字符串属性 |
| `myXml_attr_float(elem, name, def)` | 获取 float 属性 |
| `myXml_attr_int(elem, name, def)` | 获取 int 属性 |
| `myXml_new_child(parent, name)` | 创建子元素 |
| `myXml_set_attr/set_attr_int/set_attr_float` | 设置属性 |
## 依赖
- `tinyxml2`内置源码Zlib 许可证)