odata-parser-rs

Crates.ioodata-parser-rs
lib.rsodata-parser-rs
version0.1.2
sourcesrc
created_at2021-05-27 02:25:53.473848
updated_at2021-11-13 20:09:15.55659
descriptionOData EDMX v1.0 parser
homepage
repositoryhttps://github.com/Datavirke/odata-parser-rs
max_upload_size
id402471
size157,030
Mathias Pius (MathiasPius)

documentation

README

odata-parser-rs Release Latest Version Docs

Deserializes OData 3.0 metadata.xml documents.


This is an absolute bare-minimum rough implementation of the EDMX 1.0 format for parsing using serde/quick-xml into a Rust structure.

Since the purpose of this library is only to parse the metadata.xml document provided by the Danish Parliament's OpenData endpoint it does not currently support anything not explicitly used in this document, although adding such functionality is of course welcomed.

Example

Parse an example metadata.xml file, and print all the EntitySets within the default schema.

let edmx = Edmx::from_str(include_str!("my-metadata.xml")).unwrap();
let schema = edmx.default_schema().unwrap();

for entity_set in schema.entity_sets().unwrap() {
  println!("{:#?}", entity_set);
}

Using the test file from the Danish Parliament, you should see output similar to this:

EntitySet {
    name: "Afstemning",
    entity_type: "FT.Domain.Models.Afstemning",
}
EntitySet {
    name: "Afstemningstype",
    entity_type: "FT.Domain.Models.Afstemningstype",
}

(... and so on)
Commit count: 9

cargo fmt