Open kskyten opened 3 years ago
You can parse any XML file if you declare its structure using @aml
macro.
See MusicXML.jl for an example of a library that uses AcuteML: https://github.com/JuliaMusic/MusicXML.jl
Yes, but you have to define the structure of the XML in Julia first. What I'm looking for is automatically generating this Julia code to parse and generate XML based on it's schema. In MusicXML's case I would take the XML schema from here: https://www.musicxml.com/for-developers/musicxml-xsd/ and automatically generate the AcuteML code.
MusicXMLXSD provides a stricter definition of the MusicXML 3.1 format than the MusicXML Document Type Definition (DTD).
@kskyten This seems like a very good idea. However, I am not sure how we should approach this.
It is also related to #93.
Hmmm... Actually I would also benefit from this functionality. I have some XML Schemas that are generated by other people and would be great to automatically create readers and writers based on those.
What would the different types enable you to do, as opposed to using a Dict
or NamedTuple
or another single type?
Note for example that Julia's own AST representation for its syntax uses (for non-leaf nodes) the same type Expr
.
Or another example: https://github.com/yurivish/Hyperscript.jl/blob/c780f6dcd95fbf8931c7afc00499a8436075ae6c/src/Hyperscript.jl#L79-L84
GitHubHyperscript: A lightweight DOM representation for Julia - yurivish/Hyperscript.jl
It would be extremely useful to generate Julia types from XML schema files automatically. This would make it easy to generate, for example, SVG and MathML. Here is some useful code to handle XSD fschema files in Julia.