[Ocaml-pxp-users] Dtd and parse_wfdocuments

Gerd Stolpmann info at gerd-stolpmann.de
Tue Feb 7 02:03:35 PST 2006


Am Sonntag, den 05.02.2006, 02:07 +0100 schrieb Till Varoquaux:
> I need to parse a document in well formednessed mode and get it's DTD
> (but I do not want to validate the document). I figured I might as
> well kill two birds with one stone and use
>     ~transform_dtd in parse_wfdocument
> 
> However the resulting DTD (I'm not actually transforming it) contains
> no elements only entities... So what are my options. I'm guessing it's
> either:
> 1) Use a magical function that gives me full DTD and non validating
> parser in just one go.
> 2) Use a validating parser and replace the DTD with something that
> would work out.
> 3) Do two passes on the document:
>      3.1) extract_dtd_from_document_entity  to get the DTD.
>      3.2) parse_wfdocument_entity to get the document.
> 
> I'm hoping I can avoid number 3).....

Option 2) should work. Just create an empty DTD where you add all
entities, and call the method allow_arbitrary. The latter is important
because it disables validation. That new DTD should be returned by the
transform_dtd function.

Gerd

> 
> Regards,
> Till Varoquaux
> 
> _______________________________________________
> Ocaml-pxp-users mailing list
> Ocaml-pxp-users at orcaware.com
> http://www.orcaware.com/mailman/listinfo/ocaml-pxp-users
> 
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd at gerd-stolpmann.de          http://www.gerd-stolpmann.de
Telefon: 06151/153855                  Telefax: 06151/997714
------------------------------------------------------------




More information about the Ocaml-pxp-users mailing list