RE: Alternative for XML
- Posted by Tommy Carlier <tommy.carlier at pandora.be> Oct 17, 2003
- 484 views
Derek Parnell wrote: > ----- Original Message ----- > From: "Tommy Carlier" <tommy.carlier at pandora.be> > To: "EUforum" <EUforum at topica.com> > Subject: Alternative for XML > > I've created a markup language as an alternative for XML. I call it SMEL > > > > (Some Modest Extensible Language). It behaves a bit like XML, but it's > > more > > compact, and has some advanced features that XML doesn't have. To my > > opinion, it's also more human-readable, especially for programmers. > > > > I'm also making a Euphoria-library for reading and writing > > SMEL-documents. > > Is this a good idea? Would Euphoria-programmers use SMEL, or would they > > prefer using XML? > > Example: the XML-fragment: > > > > <?xml version="1.0"?> > > <data> > > <element attribute="value" attribute2="value2">Some data</element> > > <empty/> > > </data> > > > > translated into SMEL: > > > > <smel version="1.0"> > > data > > { > > element(attribute="value",attribute2="value2"){"Some data"} > > empty; > > } > Interesting. I've been playing with something very similar for use with > win32lib. Your syntax is more inclusive than I need but it might be > worth me standardizing on SMEL. > Also, you might also like to consider non-text attribute values, and > removing the '=' symbol. For example ... > <smel version{1.0}> > data > { > element(attribute{value},attribute2{value2}){"Some data"} > empty; > } > For win32lib, I could do something like ... > <smel version{1.0}> > form{ > control{type{Window}, > caption{Hello, World!}, > left{12}, > top{10}, > width{300}, > height{300}, > flags{WS_VISIBLE, WS_DLGFRAME} > }, > control{type{EditText}, > name{UserId}, > left{5}, top{5} > width(units{char}){20} > } > control{type{Button}, > caption{Close}, > flags{autoclose}, > left(from{UserId}){2}, > bottom{5} > } > } > ...hmmmm... I'll think about it some more. > -- > Derek Thanks for showing the interest in SMEL. In standard SMEL, as it exists now, the above Win32Lib-definitions would look like this: <smel version='1.0'> form { control(type='Window', caption='Hello, World!', left='12', top='10', width='300', height='300', flags='WS_VISIBLE,WS_DLGFRAME') { /* the child-controls can be defined in the body of the parent-control */ control(type='EditText', name='UserId', left='5', top='5' width='20ch'); /* 20ch = 20 chars: unit as part of the value */ control(type='Button', caption='Close', flags='autoclose', left='UserId+2', bottom='5'); } } This is just an example. You can build much more powerful constructions than that with SMEL. I'll try and post a version of the SMEL-library as soon as possible. I'm also working on SMEL-applications: specifications of SMEL-document formats like SMELS (SMEL Schema) for defining new SMEL-formats, and SMELT (SMEL Transformations) for transforming SMEL-formats to other SMEL-formats or to other text-formats (like XML or HTML). More suggestions are welcome.