After Aristotle explained to me that there's no reasonable way I can auto-generate JSON and YAML from the same Bermuda island file which defines the XML output format, I've decided to stop work on that for a while. Instead, I'm focusing my energy on the XML work. Today I've normalized the attribute and element island syntax. They're the same, except that the only quantifier allowed on an attribute is '?' (optional). Then I turned to RelaxNG generation.
This island:
--- package: My::Card island: card name: card attributes: - href: type: anyURI method: url - revision?: if: 'defined $instance->revision' type: positiveInteger elements: - name: type: string attributes: some_attr: method: dummy_attribute - email*: type: string - phone+: method: phone_numbers type: string - active: data: yes
Allows you to automatically generate this xml from an object:
John Smith js@example.com js2@example.com 111 222 yes
But it also generates RelaxNG which properly validates that XML:
yes
Yeah, I have a lot more work to do (like switching to full grammars), but this is coming along nicely.
Currently we default to UTF8, but that's easy to change. Also, I don't yet have "includes" to reference another island. That might take some major reworking of the XML to get that right, but I want to refactor a lot more of what I'm doing in order to make this workable.