auto-generating XML generator functions [was: very XiMpLe XML validation]
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Feb 9 21:34:30 UTC 2016
Hi,
On Sun, 07 Feb 2016 23:29:25 +0100
meik michalke <meik.michalke at uni-duesseldorf.de> wrote:
> Am Samstag, 30. Januar 2016, 17:11:59 schrieb meik michalke:
> > in the develop branch, XiMpLe has a new object class
> > XiMpLe.validity, a new constructor function XMLValidity() for
> > objects of that class, and a new method validXML() to check XiMpLe
> > node/tree objects against a given XiMpLe.validity definition.
>
> yet another train ride... thomas suggested something similar to this
> way back, and now it's possible: XiMpLe just gained a new method for
> objects of class XiMpLe.validity, to generate XML generators from it.
I'm glad I gave you that idea, or something similar, somehow, although
I don't really remember doing so ;-)
So, if I understand this, correctly, this holds the potential to
auto-generate a lot of the code that is in the rkwarddev-package,
today? Though, in the end, the more interesting (and hard) bit is
probably providing useful documentation and examples for each of the
generated generator functions...
Looking at this really broadly, I wonder: Perhaps the _most_ useful
thing would actually be to generate a single (internal) "workhorse"
generator function that will take the tag name as parameter, and
attributes / child nodes as lists. The job of that "workhorse" would be
to do all validation, while all other "generators" would essentially
just provide the user-visible API and documentation, but relay the
real work to the workhorse.
I believe that's essentially, the idea, already, but taken just a
little step further. E.g. the (generated) implementation of "XMLa()"
would simply be
XMLa <- function (href, name, class, id, validity) {
XMLworkhorse ("a", list (href=href, name=name, class=class, id=id),
validity))
}
Does that make sense?
Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20160209/687c9b0e/attachment.sig>
More information about the rkward-devel
mailing list