C嵌入式系统的XML库 [英] C XML library for Embedded Systems

查看:192
本文介绍了C嵌入式系统的XML库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个嵌入式系统项目,该项目正在使用XML来获取数据进出系统。我不希望XML处理能够使用 snprintf() / strcat()和朋友,或通过计数 > 字符解析XML。 >

我发现了几个XML库,其中一些甚至可能足够小,但最接近C的是C ++,它不在该系统的卡中。我希望能找到一个满足以下约束的XML库:




  • C源代码

  • 没有动态内存分配

  • 便宜。免费是更好的,但是copyleft不会这样做。



它不一定是一个完整的解析器 - 我只是想能够从嵌套元素中拉出文本,并且有一个相当简单的方式生成不依赖于格式字符串的XML。属性没有被使用(但是),所以图书馆也不需要支持他们。 XML文档会很小,所以像DOM这样的东西会很好,只要它能与客户端提供的缓冲区一起工作(解析原位XML就好了)。



PugXML和TinyXML看起来非常接近,但我希望有人在那里知道一个仅适用于我的谷歌搜索的基于C的嵌入式系统的XML库。

解决方案

我不知道动态内存分配,但标准的C XML解析器是 expat ,这是一些解析器的底层库。


I'm working on a project for an embedded system that's using XML for getting data into and out of the system. I don't want the XML handling to devolve into a bunch of bits that build XML strings using snprintf()/strcat() and friends or parse XML by counting "<" and ">" characters.

I've found several XML libraries, a couple of which might even be small enough, but the closest they come to C is C++, which is not in the cards for this system. I hoping I can find an XML library that meets the following constraints:

  • C source code
  • no dynamic memory allocation
  • cheap. Free is better, but copyleft won't do the trick.

It doesn't have to be a full parser - I just want to be able to pull text out of nested elements and have a reasonably simple way to generate XML that doesn't rely on format strings. Attributes aren't being used (yet), so the library doesn't need to support them even. The XML documents will be pretty small, so something that's DOM-like would be fine, as long as it'll work with client-provided buffers (parsing the raw XML in-place would be nice).

PugXML and TinyXML look to be pretty close, but I'm hoping that someone out there knows about an XML lib tailored just for C-based embedded systems that my googling is missing.

解决方案

I don't know about dynamic memory allocation, but a standard C XML parser is expat, which is the underlying library for a number of parsers out there.

这篇关于C嵌入式系统的XML库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆