1 Star 0 Fork 13

EricYao / xml2json

forked from Cheedoong / xml2json 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

xml2json

A header-only C++ library converts XML to JSON

Usage

xml2json is a header-only C++ library. Just copy the ./include folder to system or project's include path. Two examples are shown in xml2json.cpp and ./test/test.cpp

Build and Run a Command Line Tool

make
./xml2json input.xml

C++ API

std::string xml2json(const char *xml_str)

Description

xml2json is the first carefully written C++ library that converts XML document to JSON format. It's already been used in the soft subtitle cross-domain solution at the server-end of Tencent Video (http://v.qq.com) and its CDNs.

It's simple and fast, and with almost full support for the XML standards.

It follows these simple but carefully considered rules below:

Pattern XML JSON Access
1 <e/> "e": null o.e
2 <e>text</e> "e": "text" o.e
3 <e name="value" /> "e":{"@name": "value"} o.e["@name"]
4 <e name="value">text</e> "e": { "@name": "value", "#text": "text" } o.e["@name"] o.e["#text"]
5 <e> <a>text</a> <b>text</b> </e> "e": { "a": "text", "b": "text" } o.e.a o.e.b
6 <e> <a>text</a> <a>text</a> </e> "e": { "a": ["text", "text"] } o.e.a[0] o.e.a[1]
7 <e> text <a>text</a> </e> "e": { "#text": "text", "a": "text" } o.e["#text"] o.e.a

Tested Under

  • Linux
  • Mac OS X
  • Windows
  • OpenWRT

Donate

WeChat Pay
AliPay

The MIT License (MIT) Copyright (c) 2013 Cheedoong Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

a C++ header-only library to convert XML document to JSON format 展开 收起
JSON工具
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JSON工具
1
https://gitee.com/yaoxiujun/xml2json.git
git@gitee.com:yaoxiujun/xml2json.git
yaoxiujun
xml2json
xml2json
master

搜索帮助