TinyXML-2
=========
[![Test](https://github.com/leethomason/tinyxml2/actions/workflows/test.yml/badge.svg)](https://github.com/leethomason/tinyxml2/actions/workflows/test.yml)
TinyXML-2 is a simple, small, efficient, C++ XML parser that can be
easily integrated into other programs.
The master is hosted on github:
https://github.com/leethomason/tinyxml2
The online HTML version of these docs:
http://leethomason.github.io/tinyxml2/
Examples are in the "related pages" tab of the HTML docs.
What it does.
-------------
In brief, TinyXML-2 parses an XML document, and builds from that a
Document Object Model (DOM) that can be read, modified, and saved.
XML stands for "eXtensible Markup Language." It is a general purpose
human and machine readable markup language to describe arbitrary data.
All those random file formats created to store application data can
all be replaced with XML. One parser for everything.
http://en.wikipedia.org/wiki/XML
There are different ways to access and interact with XML data.
TinyXML-2 uses a Document Object Model (DOM), meaning the XML data is parsed
into a C++ objects that can be browsed and manipulated, and then
written to disk or another output stream. You can also construct an XML document
from scratch with C++ objects and write this to disk or another output
stream. You can even use TinyXML-2 to stream XML programmatically from
code without creating a document first.
TinyXML-2 is designed to be easy and fast to learn. It is one header and
one cpp file. Simply add these to your project and off you go.
There is an example file - xmltest.cpp - to get you started.
TinyXML-2 is released under the ZLib license,
so you can use it in open source or commercial code. The details
of the license are at the top of every source file.
TinyXML-2 attempts to be a flexible parser, but with truly correct and
compliant XML output. TinyXML-2 should compile on any reasonably C++
compliant system. It does not rely on exceptions, RTTI, or the STL.
What it doesn't do.
-------------------
TinyXML-2 doesn't parse or use DTDs (Document Type Definitions) or XSLs
(eXtensible Stylesheet Language.) There are other parsers out there
that are much more fully featured. But they are generally bigger and
more difficult to use. If you are working with
browsers or have more complete XML needs, TinyXML-2 is not the parser for you.
TinyXML-1 vs. TinyXML-2
-----------------------
TinyXML-2 long been the focus of all development. It is well tested
and should be used instead of TinyXML-1.
TinyXML-2 uses a similar API to TinyXML-1 and the same
rich test cases. But the implementation of the parser is completely re-written
to make it more appropriate for use in a game. It uses less memory, is faster,
and uses far fewer memory allocations.
TinyXML-2 has no requirement or support for STL.
Features
--------
### Code Page
TinyXML-2 uses UTF-8 exclusively when interpreting XML. All XML is assumed to
be UTF-8.
Filenames for loading / saving are passed unchanged to the underlying OS.
### Memory Model
An XMLDocument is a C++ object like any other, that can be on the stack, or
new'd and deleted on the heap.
However, any sub-node of the Document, XMLElement, XMLText, etc, can only
be created by calling the appropriate XMLDocument::NewElement, NewText, etc.
method. Although you have pointers to these objects, they are still owned
by the Document. When the Document is deleted, so are all the nodes it contains.
### White Space
#### Whitespace Preservation (default, PRESERVE_WHITESPACE)
Microsoft has an excellent article on white space: http://msdn.microsoft.com/en-us/library/ms256097.aspx
By default, TinyXML-2 preserves white space in a (hopefully) sane way that is almost compliant with the
spec. (TinyXML-1 used a completely different model, much more similar to 'collapse', below.)
As a first step, all newlines / carriage-returns / line-feeds are normalized to a
line-feed character, as required by the XML spec.
White space in text is preserved. For example:
<element> Hello, World</element>
The leading space before the "Hello" and the double space after the comma are
preserved. Line-feeds are preserved, as in this example:
<element> Hello again,
World</element>
However, white space between elements is **not** preserved. Although not strictly
compliant, tracking and reporting inter-element space is awkward, and not normally
valuable. TinyXML-2 sees these as the same XML:
<document>
<data>1</data>
<data>2</data>
<data>3</data>
</document>
<document><data>1</data><data>2</data><data>3</data></document>
#### Whitespace Collapse (COLLAPSE_WHITESPACE)
For some applications, it is preferable to collapse whitespace. Collapsing
whitespace gives you "HTML-like" behavior, which is sometimes more suitable
for hand typed documents.
TinyXML-2 supports this with the 'whitespace' parameter to the XMLDocument constructor.
(The default is to preserve whitespace, as described above.)
However, you may also use COLLAPSE_WHITESPACE, which will:
* Remove leading and trailing whitespace
* Convert newlines and line-feeds into a space character
* Collapse a run of any number of space characters into a single space character
Note that (currently) there is a performance impact for using COLLAPSE_WHITESPACE.
It essentially causes the XML to be parsed twice.
#### Pedantic Whitespace (PEDANTIC_WHITESPACE)
For applications that need to know about text nodes that are composed entirely of
whitespace, PEDANTIC_WHITESPACE is available. PEDANTIC_WHITESPACE maintains all the
whilespace between elements.
PEDANTIC_WHITESPACE is a new mode and not as tested as the other whitespace modes.
### Error Reporting
TinyXML-2 reports the line number of any errors in an XML document that
cannot be parsed correctly. In addition, all nodes (elements, declarations,
text, comments etc.) and attributes have a line number recorded as they are parsed.
This allows an application that performs additional validation of the parsed
XML document (e.g. application-implemented DTD validation) to report
line number information for error messages.
### Entities
TinyXML-2 recognizes the pre-defined "character entities", meaning special
characters. Namely:
& &
< <
> >
" "
' '
These are recognized when the XML document is read, and translated to their
UTF-8 equivalents. For instance, text with the XML of:
Far & Away
will have the Value() of "Far & Away" when queried from the XMLText object,
and will be written back to the XML stream/file as an ampersand.
Additionally, any character can be specified by its Unicode code point:
The syntax ` ` or ` ` are both to the non-breaking space character.
This is called a 'numeric character reference'. Any numeric character reference
that isn't one of the special entities above, will be read, but written as a
regular code point. The output is correct, but the entity syntax isn't preserved.
### Printing
#### Print to file
You can directly use the convenience function:
XMLDocument doc;
...
doc.SaveFile( "foo.xml" );
Or the XMLPrinter class:
XMLPrinter printer( fp );
doc.Print( &printer );
#### Print to memory
Printing to memory is supported by the XMLPrinter.
XMLPrinter printer;
doc.Print( &printer );
// printer.CStr() has a const char* to the XML
#### Print without an XMLDocument
When loading, an XML parser is very useful. However, sometimes
when saving, it just gets in the way. The code is often set up
for streaming, and constructing the DOM is just overhead.
The Printer supports the streaming case. The following code
prints out a trivially simple XML file without ever creating
an XML document.
XMLPrinter printer( fp );
printer.OpenElement( "foo" );
printer.PushAttribute( "foo", "bar" );
printer.CloseElement();
Examples
--------
#### Load and parse an XML file.
/* ------ Example 1: Load and parse an XML file. ---- */
{
XMLDocument doc;
doc.LoadFile( "dream.xml" );
}
没有合适的资源?快使用搜索试试~ 我知道了~
C语言读取XMl文件并将其写入进去db文件
共314个文件
html:122个
js:52个
png:33个
需积分: 5 0 下载量 153 浏览量
2024-03-28
17:25:08
上传
评论
收藏 16MB ZIP 举报
温馨提示
C语言读取XMl文件并将其写入进去db文件
资源推荐
资源详情
资源评论
收起资源包目录
C语言读取XMl文件并将其写入进去db文件 (314个子文件)
Project1.aps 1KB
meson.build 2KB
tinyxml2-config.cmake 2KB
xmltest.cpp 93KB
tinyxml2.cpp 77KB
USLand.cpp 10KB
USL.cpp 6KB
html5-printer.cpp 4KB
doxygen.css 31KB
tabs.css 9KB
search.css 4KB
Browse.VC.db 3.38MB
Solution.VC.db 428KB
sqlite3.dll 3.37MB
libxml2.dll 2.18MB
iconv-2.dll 1.42MB
liblzma.dll 504KB
zlibd1.dll 205KB
dox 107KB
Project1.exe 73KB
Project1.vcxproj.filters 1KB
.gitignore 263B
tinyxml2.h 81KB
tinyxml2.h 73KB
resource.h 387B
tinyxml2_8h_source.html 381KB
classtinyxml2_1_1_x_m_l_element.html 82KB
classtinyxml2_1_1_x_m_l_document.html 58KB
classtinyxml2_1_1_x_m_l_node.html 42KB
classtinyxml2_1_1_x_m_l_text.html 33KB
classtinyxml2_1_1_x_m_l_declaration.html 32KB
classtinyxml2_1_1_x_m_l_unknown.html 32KB
classtinyxml2_1_1_x_m_l_comment.html 31KB
classtinyxml2_1_1_x_m_l_element-members.html 31KB
classtinyxml2_1_1_x_m_l_printer.html 27KB
classtinyxml2_1_1_x_m_l_attribute.html 20KB
classtinyxml2_1_1_x_m_l_document-members.html 20KB
classtinyxml2_1_1_x_m_l_handle.html 18KB
index.html 16KB
classtinyxml2_1_1_x_m_l_text-members.html 14KB
classtinyxml2_1_1_x_m_l_declaration-members.html 13KB
classtinyxml2_1_1_x_m_l_unknown-members.html 13KB
classtinyxml2_1_1_x_m_l_comment-members.html 13KB
classtinyxml2_1_1_x_m_l_node-members.html 13KB
classtinyxml2_1_1_x_m_l_printer-members.html 11KB
classtinyxml2_1_1_x_m_l_visitor.html 11KB
classtinyxml2_1_1_x_m_l_attribute-members.html 10KB
classtinyxml2_1_1_x_m_l_handle-members.html 9KB
annotated.html 7KB
hierarchy.html 7KB
functions_q.html 6KB
_example_3.html 6KB
functions_func_q.html 6KB
classtinyxml2_1_1_x_m_l_visitor-members.html 6KB
functions_s.html 6KB
functions_func_s.html 6KB
_example_4.html 5KB
functions_t.html 5KB
functions_func_t.html 5KB
functions_p.html 5KB
functions_n.html 5KB
functions_i.html 5KB
functions_func_p.html 5KB
functions_func_n.html 5KB
functions_func_i.html 5KB
functions_d.html 4KB
functions_f.html 4KB
classes.html 4KB
functions_func_d.html 4KB
functions_func_f.html 4KB
functions_v.html 4KB
functions.html 4KB
classtinyxml2_1_1_x_m_l_const_handle.html 4KB
functions_c.html 4KB
pages.html 4KB
functions_func_v.html 4KB
functions_func.html 4KB
functions_func_c.html 4KB
_example_2.html 4KB
functions_u.html 4KB
functions_g.html 4KB
functions_l.html 4KB
functions_func_u.html 4KB
_example_1.html 4KB
functions_e.html 3KB
functions_func_g.html 3KB
functions_func_l.html 3KB
functions_func_e.html 3KB
functions_b.html 3KB
functions_x.html 3KB
classtinyxml2_1_1_x_m_l_const_handle-members.html 3KB
files.html 3KB
functions_func_b.html 3KB
functions_func_x.html 3KB
functions_o.html 3KB
functions_func_o.html 3KB
functions_r.html 3KB
functions_h.html 3KB
functions_func_r.html 3KB
functions_func_h.html 3KB
共 314 条
- 1
- 2
- 3
- 4
资源评论
Ar.半衫茯苓
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- IMG_0694.GIF
- 基于图像的三维模型重建C++源代码+文档说明(高分课程设计)
- 基于聚焦法的工件立体测量方案,根据数据进行三维重建 使用HALCON处理图像,MATLAB拟合数据+源代码+数据集+效果图
- 锄战三国村 修改:货币使用不减 v1.10(2) 原创 (中文).apk
- 基于python实现的单目双目视觉三维重建+源代码+图像图片(高分课程设计)
- 基于C+++OPENCV的全景图像拼接源码(课程设计)
- 基于Python+OpenCV对多张图片进行全景图像拼接,消除鬼影,消除裂缝+源代码+文档说明+界面截图(高分课程设计)
- 基于C++实现的全景图像拼接源码(课程设计)
- 基于SIFT特征点提取和RASIC算法实现全景图像拼接python源码+文档说明+界面截图+详细注释(95分以上课程大作业)
- 基于matlab实现眼部判别的疲劳检测系统+源代码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功