5 个版本
使用旧的 Rust 2015
0.2.0 | 2016 年 2 月 14 日 |
---|---|
0.1.3 | 2015 年 12 月 20 日 |
0.1.2 | 2015 年 9 月 4 日 |
0.1.1 | 2015 年 5 月 16 日 |
0.1.0 | 2015 年 5 月 16 日 |
18 在 #json-xml
100 每月下载次数
14KB
286 行
xmlJSON
将 XML 数据转换为 JSON。请注意,这尚未经过充分的测试。请自行承担风险。
状态
用法
将其添加到您的 Cargo.toml 中
[dependencies]
xmlJSON = "0.1.3"
用于从 XML 转换为 JSON 的结构体
extern crate xmlJSON;
extern crate rustc_serialize;
use xmlJSON::XmlDocument;
use rustc_serialize::json;
use std::str::FromStr;
let s = "<test lang=\"rust\">An XML Document <testElement>A test
element</testElement></test>"
let document : XmlDocument = XmlDocument::from_str(s).unwrap();
let jsn : json::Json = document.to_json();
生成的 Json 将是以下形式
{
"test": {
"$": {
"lang": "rust"
},
"_" : "An Xml Document",
"testElement": {
"_" : "A test element"
}
}
}
并将其添加到您的 crate 根目录中
extern crate xmlJSON;
许可证
许可协议为以下之一
- Apache 许可证 2.0 版,(LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT 许可证 (LICENSE-MIT 或 http://opensource.org/licenses/MIT)
任选其一。
贡献
除非您明确声明,否则根据 Apache-2.0 许可证定义的,您有意提交以包含在作品中的任何贡献,将按上述方式双许可,不附加任何额外的条款或条件。
待办事项
- 添加更好的测试
- 添加文档
- 添加从 JSON 转换为 XML 的功能,并允许将 JSON 写入 XML
依赖项
~625KB
~13K SLoC