[Ocaml-pxp-users] validation with an external DTD
Gerd Stolpmann
info at gerd-stolpmann.de
Fri Jun 27 06:24:04 PDT 2003
Am Fre, 2003-06-27 um 12.30 schrieb Stefano Zacchiroli:
> Hi PXPers,
> I would like to load an XML document using the validating mode of PXP,
> but I want to specify an external DTD which is not the one referenced by
> the XML document.
>
> This is quite easy using the "transform_dtd" optional argument of
> "parse_document_entity". Anyway this still require that the parsed
> document begins with a <!DOCTYPE....>.
>
> Is it possible to validate documents with no DOCTYPE declaration against
> an external DTD?
parse_content_entity does exactly this. You pass the dtd to this
function, and it validates the input file against it.
> I've also thought about parsing in well formedness mode only and then
> validate against a DTD but I've found no way to change the DTD of a
> document object ...
Although you do not need it: Changing the DTD is only possible with
Pxp_marshal.relocate_subtree. This is an expensive operation.
In the newest release (1.1.94), parse_wfdocument_entity has
~transform_dtd, too.
I have considered to add a mutator to the nodes that changes the dtd
directly. However, this is a very delicate operation, because the dtd
ensures several consistency conditions.
Gerd
--
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany
gerd at gerd-stolpmann.de http://www.gerd-stolpmann.de
------------------------------------------------------------
More information about the Ocaml-pxp-users
mailing list