{"id":13439377,"url":"https://github.com/Florob/RustyXML","last_synced_at":"2025-03-20T08:30:37.526Z","repository":{"id":57666073,"uuid":"11722478","full_name":"Florob/RustyXML","owner":"Florob","description":"A XML parser written in Rust","archived":false,"fork":false,"pushed_at":"2021-09-05T09:19:22.000Z","size":304,"stargazers_count":103,"open_issues_count":1,"forks_count":19,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-09-20T02:09:22.325Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Florob.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-28T16:39:00.000Z","updated_at":"2024-06-21T10:04:25.000Z","dependencies_parsed_at":"2022-09-14T13:01:49.640Z","dependency_job_id":null,"html_url":"https://github.com/Florob/RustyXML","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Florob%2FRustyXML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Florob%2FRustyXML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Florob%2FRustyXML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Florob%2FRustyXML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Florob","download_url":"https://codeload.github.com/Florob/RustyXML/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221739700,"owners_count":16872775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:13.402Z","updated_at":"2024-10-27T22:30:47.619Z","avatar_url":"https://github.com/Florob.png","language":"Rust","funding_links":[],"categories":["Libraries","代码","库 Libraries","库"],"sub_categories":["Encoding","编码","编码 Encoding","加密 Encoding","编码(Encoding)"],"readme":"RustyXML\n========\n\n[![Build Status](https://travis-ci.org/Florob/RustyXML.svg?branch=master)](https://travis-ci.org/Florob/RustyXML)\n\n[Documentation](https://docs.babelmonkeys.de/RustyXML/xml)\n\nRustyXML is a namespace aware XML parser written in Rust.\nRight now it provides a basic SAX-like API, and an ElementBuilder based on that.\n\nThe parser itself is derived from OFXMLParser as found in ObjFW\n\u003chttps://webkeks.org/objfw/\u003e.\n\nThe current limitations are:\n* Incomplete error checking\n* Unstable API\n\nThe Minimal Supported Rust Version for this crate is Rust 1.40.0.\n\nExamples\n--------\nParse a string into an `Element` struct:\n```rust\nuse xml::Element;\n\nlet elem: Option\u003cElement\u003e = \"\u003ca href='//example.com'/\u003e\".parse();\n```\n\nGet events from parsing string data:\n```rust\nuse xml::{Event, Parser};\n\n// Create a new Parser\nlet mut p = Parser::new();\n\n// Feed data to be parsed\np.feed_str(\"\u003ca href\");\np.feed_str(\"='//example.com'/\u003e\");\n\n// Get events for the fed data\nfor event in p {\n    match event.unwrap() {\n        Event::ElementStart(tag) =\u003e println!(\"\u003c{}\u003e\", tag.name),\n        Event::ElementEnd(tag) =\u003e println!(\"\u003c/{}\u003e\", tag.name),\n        _ =\u003e ()\n    }\n}\n```\n\nThis should print:\n```\n\u003ca\u003e\n\u003c/a\u003e\n```\n\nBuild `Element`s from `Parser` `Event`s:\n```rust\nuse xml::{Parser, ElementBuilder};\n\nlet mut p = xml::Parser::new();\nlet mut e = xml::ElementBuilder::new();\n\np.feed_str(\"\u003ca href='//example.com'/\u003e\");\nfor elem in p.filter_map(|x| e.handle_event(x)) {\n    match elem {\n        Ok(e) =\u003e println!(\"{}\", e),\n        Err(e) =\u003e println!(\"{}\", e),\n    }\n}\n```\n\nBuild `Element`s by hand:\n```rust\nlet mut reply = xml::Element::new(\"iq\".into(), Some(\"jabber:client\".into()),\n                                  vec![(\"type\".into(), None, \"error\".into()),\n                                       (\"id\".into(), None, \"42\".into())]);\nreply.tag(xml::Element::new(\"error\".into(), Some(\"jabber:client\".into()),\n                            vec![(\"type\".into(), None, \"cancel\".into())]))\n     .tag_stay(xml::Element::new(\"forbidden\".into(),\n                                 Some(\"urn:ietf:params:xml:ns:xmpp-stanzas\".into()),\n                                 vec![]))\n     .tag(xml::Element::new(\"text\".into(),\n                            Some(\"urn:ietf:params:xml:ns:xmpp-stanzas\".into()),\n                            vec![]))\n     .text(\"Permission denied\".into());\n```\nResult (some whitespace added for readability):\n```xml\n\u003ciq xmlns='jabber:client' id='42' type='error'\u003e\n  \u003cerror type='cancel'\u003e\n    \u003cforbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/\u003e\n    \u003ctext xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'\u003ePermission denied\u003c/text\u003e\n  \u003c/error\u003e\n\u003c/iq\u003e\n```\n\nAttribute Order\n---------------\n\nBy default the order of attributes is not tracked. Therefore during serialization and iteration\ntheir order will be random. This can be changed by enabling the `ordered_attrs` feature.\nWith this feature enabled the order attributes were encountered while parsing,\nor added to an `Element` will be preserved.\n\nLicense\n-------\n\nLicensed under either of\n\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFlorob%2FRustyXML","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFlorob%2FRustyXML","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFlorob%2FRustyXML/lists"}