Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON to XML #9

Open
owennewo opened this issue Apr 27, 2017 · 1 comment
Open

JSON to XML #9

owennewo opened this issue Apr 27, 2017 · 1 comment

Comments

@owennewo
Copy link

owennewo commented Apr 27, 2017

Having parsed a musicxml document into JSON using cxml. I can update the JSON and render it visually. Can you think a way of exporting the JSON back to musicxml after modifications.

I'd also like to create a JSON musicxml doc from scratch using javascript. Whilst i can create the json using duck typing - it doesn't have the XmlType wrappers which means that handling it in rendering engine is different/harder (e.g. no _exists). Some of the types that I wish to create don't seem to have constructors.

Looking at the following which was created using cxsd:
https://github.com/owennewo/musicxml-ts/blob/master/app/xmlns/www.musicxml.org.d.ts

I can create a note
let note = new musicxml.note();
but not
let measure = new musicxml.measure();

The latter gives
TypeError: musicxml.measure is not a constructor

@jjrv
Copy link
Member

jjrv commented Apr 29, 2017

The new version in rewrite branch will include a Writer class. The pipeline will be first a tokenizer written in C++ and JavaScript, which emits a stream of tokens like opening element name, attribute name, attribute value... Optionally they can be fed into a "DOM/JSON builder" that produces output as the currently released version. The writer can then consume the JSON or the token stream (latter is much faster) and produce XML.

Unfortunately the token stream will still take at least two weeks of work, and the redesigned JSON support maybe an additional month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants