musicxml_dom/
lib.rs

1pub struct LinkAttributes {
2    href: String,
3    role: Option<String>,
4    title: Option<String>,
5    show: String,
6    actuate: String,
7}
8
9pub struct Work {
10    work_number: Option<String>,
11    work_title: Option<String>,
12    opus: Option<LinkAttributes>,
13}
14
15pub struct TypedText {
16    content: String,
17    // keyword
18    type_: Option<String>,
19}
20
21pub struct Supports {
22    type_: bool,
23    element: String,
24    attribute: Option<String>,
25    value: Option<String>,
26}
27
28pub enum Encoding {
29    EncodingDate(String),
30    Encoder(TypedText),
31    Software(String),
32    EncodingDescription(String),
33    Supports(Supports),
34}
35
36pub struct Miscellaneous {
37    name: String,
38    value: String,
39}
40
41/**
42 * encoding and miscellaneous don't exactly represent the source blocks.  If the encoding or
43 * miscellaneous tags exist, but they don't have any contents, they will still be empty vectors.
44 * I don't think this is an issue.  I can't think of a reason a parser would want to pay attention
45 * to that.
46 */
47pub struct Identification {
48    creator: Vec<TypedText>,
49    rights: Vec<TypedText>,
50    encoding: Vec<Encoding>,
51    source: Option<String>,
52    relation: Vec<TypedText>,
53    miscellaneous: Vec<Miscellaneous>,
54}
55
56pub struct ScoreHeader {
57    work: Option<Work>,
58    movement_number: Option<String>,
59    movement_title: Option<String>,
60    identification: Option<Identification>,
61}
62
63pub struct ScorePartwise {
64    version: String,
65    score_header: ScoreHeader,
66}
67
68pub enum Document {
69    ScorePartwise(ScorePartwise),
70    //ScoreTimewise(ScoreTimewise),
71}
72
73#[cfg(test)]
74mod tests {
75    #[test]
76    fn it_works() {
77        assert_eq!(2 + 2, 4);
78    }
79}