@@ -6,29 +6,51 @@ impl Encode for Device {
6
6
7
7
fn encode ( & self ) -> Result < Element , EncodeError > {
8
8
let mut elem = Element :: new ( "device" ) ;
9
+ if let Some ( v) = & self . vendor {
10
+ elem. children . push ( new_node ( "vendor" , v. clone ( ) ) ) ;
11
+ }
12
+ if let Some ( v) = & self . vendor_id {
13
+ elem. children . push ( new_node ( "vendorID" , v. clone ( ) ) ) ;
14
+ }
15
+
9
16
elem. children . push ( new_node ( "name" , self . name . clone ( ) ) ) ;
10
17
11
- if let Some ( v) = & self . version {
12
- elem. children . push ( new_node ( "version " , v. clone ( ) ) ) ;
18
+ if let Some ( v) = & self . series {
19
+ elem. children . push ( new_node ( "series " , v. clone ( ) ) ) ;
13
20
}
14
21
15
- if let Some ( v) = & self . description {
16
- elem. children . push ( new_node ( "description" , v. clone ( ) ) ) ;
22
+ elem. children
23
+ . push ( new_node ( "version" , self . version . clone ( ) ) ) ;
24
+
25
+ elem. children
26
+ . push ( new_node ( "description" , self . description . clone ( ) ) ) ;
27
+
28
+ if let Some ( v) = & self . license_text {
29
+ elem. children . push ( new_node ( "licenseText" , v. clone ( ) ) ) ;
17
30
}
18
31
19
32
if let Some ( v) = & self . cpu {
20
33
elem. children . push ( XMLNode :: Element ( v. encode ( ) ?) ) ;
21
34
}
22
35
23
- if let Some ( v) = & self . address_unit_bits {
36
+ if let Some ( v) = & self . header_system_filename {
24
37
elem. children
25
- . push ( new_node ( "addressUnitBits " , format ! ( "{}" , v ) ) ) ;
38
+ . push ( new_node ( "headerSystemFilename " , v . clone ( ) ) ) ;
26
39
}
27
40
28
- if let Some ( v) = & self . width {
29
- elem. children . push ( new_node ( "width" , format ! ( "{}" , v) ) ) ;
41
+ if let Some ( v) = & self . header_definitions_prefix {
42
+ elem. children
43
+ . push ( new_node ( "header_definitions_prefix" , v. clone ( ) ) ) ;
30
44
}
31
45
46
+ elem. children . push ( new_node (
47
+ "addressUnitBits" ,
48
+ format ! ( "{}" , self . address_unit_bits) ,
49
+ ) ) ;
50
+
51
+ elem. children
52
+ . push ( new_node ( "width" , format ! ( "{}" , self . width) ) ) ;
53
+
32
54
elem. children
33
55
. extend ( self . default_register_properties . encode ( ) ?) ;
34
56
@@ -43,20 +65,14 @@ impl Encode for Device {
43
65
XMLNode :: Element ( e)
44
66
} ) ;
45
67
68
+ elem. attributes
69
+ . insert ( String :: from ( "schemaVersion" ) , self . schema_version . clone ( ) ) ;
70
+ elem. attributes
71
+ . insert ( String :: from ( "xmlns:xs" ) , self . xmlns_xs . clone ( ) ) ;
46
72
elem. attributes . insert (
47
- String :: from ( "xmlns:xs " ) ,
48
- String :: from ( "http://www.w3.org/2001/XMLSchema-instance" ) ,
73
+ String :: from ( "xs:noNamespaceSchemaLocation " ) ,
74
+ self . no_namespace_schema_location . clone ( ) ,
49
75
) ;
50
- if let Some ( schema_version) = & self . schema_version {
51
- elem. attributes
52
- . insert ( String :: from ( "schemaVersion" ) , schema_version. to_string ( ) ) ;
53
- }
54
- if let Some ( schema_version) = & self . schema_version {
55
- elem. attributes . insert (
56
- String :: from ( "xs:noNamespaceSchemaLocation" ) ,
57
- format ! ( "CMSIS-SVD_Schema_{}.xsd" , schema_version. replace( "." , "_" ) ) ,
58
- ) ;
59
- }
60
76
61
77
Ok ( elem)
62
78
}
0 commit comments