File tree 4 files changed +39
-4
lines changed
4 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,11 @@ See [Type Definition](https://aminya.github.io/AcuteML.jl/dev/#Main-macro-and-I/
40
40
# Example - Simple
41
41
``` julia
42
42
using AcuteML
43
- @aml mutable struct Body " ~"
43
+
44
+ # the xml/html name of each property is written in front of it (e.g. "body")
45
+ # `~` means that the struct property name is the same as xml/html name
46
+
47
+ @aml mutable struct Body " body"
44
48
h1, " ~"
45
49
p:: Vector{String} , " ~"
46
50
end
@@ -58,11 +62,11 @@ julia> pprint(d)
58
62
<?xml version =" 1.0" encoding =" UTF-8" standalone =" yes" ?>
59
63
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd" >
60
64
<html >
61
- <Body >
65
+ <body >
62
66
<h1 >My heading</h1 >
63
67
<p >Paragraph1</p >
64
68
<p >Paragraph2</p >
65
- </Body >
69
+ </body >
66
70
</html >
67
71
```
68
72
Original file line number Diff line number Diff line change 1
1
using AcuteML
2
- @aml mutable struct Body " ~"
2
+
3
+ # `~` means that the struct property name is the same as xml/html name
4
+
5
+ @aml mutable struct Body " body"
3
6
h1, " ~"
4
7
p:: Vector{String} , " ~"
5
8
end
Original file line number Diff line number Diff line change
1
+ using AcuteML
2
+
3
+ @aml mutable struct inner " ~"
4
+ id1:: Int , att " ~"
5
+ desc1:: String , " ~"
6
+ end
7
+
8
+ @aml mutable struct outer doc " outer"
9
+ id2:: Int , att " ~"
10
+ innerList:: Vector{inner} , " inner"
11
+ end
12
+
13
+ i1 = inner (id1 = 1 , desc1 = " desc1" )
14
+ i2 = inner (id1 = 2 , desc1 = " desc2" )
15
+ o1 = outer (id2 = 3 , innerList = [i1, i2])
16
+ pprint (o1)
17
+
18
+ pprint (" ./o1.xml" , o1)
19
+
20
+
21
+ xml = readxml (" ./o1.xml" )
22
+
23
+ o2 = outer (xml)
24
+
25
+
26
+ rm (" ./o1.xml" )
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ include("errors.jl")
17
17
end
18
18
@testset " simple" begin
19
19
include (" ../examples/simple.jl" )
20
+
21
+ include (" ./issue_142.jl" )
20
22
end
21
23
22
24
# # MusicXML tests
You can’t perform that action at this time.
0 commit comments