[Ocaml-pxp-users] The meaning of ANY

Gerd Stolpmann gerd at gerd-stolpmann.de
Mon Feb 1 06:30:07 PST 2010


Am Samstag, den 30.01.2010, 07:57 -0800 schrieb Dario Teixeira:
> Hi,
> 
> > PXP has an option that allows undeclared elements (put <?pxp:dtd
> > optional-element-and-notation-declarations?> into the DTD), so that
> > you practically get the effect you want. Look at intro_advanced.txt
> > in the distribution for more documentation.
> 
> Thank you very much for the prompt reply; it was much appreciated.
> That instruction does work as advertised, and from looking at the
> source code I discovered that it essentially just invokes method
> 'allow_arbitrary' from class Pxp_dtd.dtd.  I am now invoking this
> method directly instead of using the processing instruction.
> 
> There is however one problem with this approach.  Suppose an extraneous
> element 'foo' is declared somewhere outside of 'mathmlblk'.  While PXP
> correctly raises an error indicating that the top-level 'document' does
> not match its content model, this error is too generic, giving no clue
> that it was the declaration of 'foo' that caused the violation.  Is
> there some way to either a) invoke some callback whenever an unknown
> element is found, or b) get more detailed information about the error?

No, there is nothing about that.

What you could do is to parse first in well-formedness mode, check the
tree for unknown elements, and validate later. This is a bit tricky,
however - just calling Pxp_tree_parser.parse_wfdocument followed by
Pxp_document.validate will not work because the DTD object is not set up
for validation then. The correct way is to parse as stream
(Pxp_ev_parser.create_pull_parser), and convert the stream to a tree
(Pxp_document.solidify), followed by Pxp_document.validate.

Gerd

> 
> Thanks again for your time.
> Best regards,
> Dario Teixeira
> 
> 
> 
> 
>       
> 
-- 
------------------------------------------------------------
Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany 
gerd at gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714
------------------------------------------------------------



More information about the Ocaml-pxp-users mailing list