Module Ez_html.Dtd
The DTD Functions
val parse_file : string -> Xml_types.dtd
Parse the named file into a Dtd data structure. Raise
Xml_types
.File_not_found if an error occurred while opening the file. RaiseDtd.Parse_error
if parsing failed.
val parse_in : Stdlib.in_channel -> Xml_types.dtd
Read the content of the in_channel and parse it into a Dtd data structure. Raise
Dtd.Parse_error
if parsing failed.
val parse_string : string -> Xml_types.dtd
Parse the string containing a Dtd document into a Dtd data structure. Raise
Dtd.Parse_error
if parsing failed.
val check : Xml_types.dtd -> checked
Check the Dtd data structure declaration and return a checked DTD. Raise
Dtd.Check_error
if the DTD checking failed.
val prove : checked -> string -> Xml_types.xml -> Xml_types.xml
Prove an Xml document using a checked DTD and an entry point. The entry point is the first excepted tag of the Xml document, the returned Xml document has the same structure has the original one, excepted that non declared optional attributes have been set to their default value specified in the DTD. Raise
Dtd.Check_error
ElementNotDeclared
if the entry point is not found, raiseDtd.Prove_error
if the Xml document failed to be proved with the DTD.
val to_string : Xml_types.dtd_item -> string
Print a DTD element into a string. You can easily get a DTD document from a DTD data structure using for example
String.concat "\n" (List.map Dtd.to_string) my_dtd
The DTD Exceptions
type parse_error_msg
=
|
InvalidDTDDecl
|
InvalidDTDElement
|
InvalidDTDAttribute
|
InvalidDTDTag
|
DTDItemExpected
type check_error
=
type prove_error
=
type parse_error
= parse_error_msg * Xml_types.error_pos
exception
Parse_error of parse_error
exception
Check_error of check_error
exception
Prove_error of prove_error
val parse_error : parse_error -> string
val check_error : check_error -> string
val prove_error : prove_error -> string