[Ocaml-pxp-users] Modifying DTD on-the-fly
Dario Teixeira
darioteixeira at yahoo.com
Mon Jan 19 09:36:15 PST 2015
Hi,
> No, this isn't implemented, neither for the tree case nor the event case
> (which is basically using the same code: for event-based validation a
> rudimentary tree is maintained and continuously validated).
And thanks for the reply, Gerd. Even if the on-the-fly approach were possible,
in the meantime I have come cross another issue in PXP that would've limited
its use: there is no way to clone a DTD. (My idea was to start with a pristine
DTD parsed only once upon startup, and then clone it and patch it on-the-fly
for each invocation).
I ended up adopting a more hackish solution (basically I patch the textual
definition of the DTD before parsing it, and use a hash table to cache common
invocations), which nevertheless works fine and is relatively clean:
https://github.com/darioteixeira/lambdoc/blob/master/src/lib/lambdoc_read_lambxml_impl/dtd.ml
> There is the alternative that you parse unvalidated, and apply the DTD
> constraints later (this would require a tree, of course).
Yes, that's also a good option -- thanks!
Kind regards,
Dario Teixeira
More information about the Ocaml-pxp-users
mailing list