[Ocaml-pxp-users] Modifying DTD on-the-fly

Gerd Stolpmann info at gerd-stolpmann.de
Sat Jan 17 10:57:35 PST 2015


Am Mittwoch, den 14.01.2015, 12:25 +0000 schrieb Dario Teixeira:
> Hi,
> 
> Does PXP allow for a DTD to be modified on-the-fly?  Obviously
> I don't expect this to work in tree-parsing mode, but when parsed
> as a tree of events, can I modify the DTD at any point and expect
> that to influence subsequent parsing?

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).

The point is not that you couldn't trigger revalidation. For trees,
there are the validate, validate_contents, and validate_attlist methods.
If the tree has changed, these methods will check the validation
constraints again. However, I did not have the case in mind that the DTD
changes. There are some derived values in the tree that would have to be
recomputed if the DTD changes, and this isn't done.

As you explicitly mention subsequent parsing: this could in deed work,
because this would only affect new nodes. However, you'll have a hard
time synchronizing the DTD changes with the parser progress (in
particular for event parsing, the parser caches up a few events before
returning something to the user).

There is the alternative that you parse unvalidated, and apply the DTD
constraints later (this would require a tree, of course).

Gerd

> 
> Thanks in advance for your time!
> Best regards,
> Dario Teixeira
> _______________________________________________
> Ocaml-pxp-users mailing list
> Ocaml-pxp-users at orcaware.com
> http://www.orcaware.com/mailman/listinfo/ocaml-pxp-users

-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd at gerd-stolpmann.de
My OCaml site:          http://www.camlcity.org
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <http://www.orcaware.com/pipermail/ocaml-pxp-users/attachments/20150117/f58d9c2f/attachment.sig>


More information about the Ocaml-pxp-users mailing list