That application generates an XML parser (SAX) from a valid DTD. Some DTD tags only give rise to a processing (list of handled tags), others are ignored.
The DTD (Document Type Definition) defines the vocabulary and the structure of an XML document. A DTD is characterized by a set of rules that specify the elements and their attributes, as well as their relationship, their sequence and their frequency within the XML document.
Processings can be linked to an XML document's tags in event handlers: this is done by the parser. Here, this non-validating parser skeleton is created from a DTD. A given processing still has then to be written for each embryonic events handler.
That parser is based on SAX (Simple API for XML): it allows a sequential reading of the XML flux. It is therefore not much memory greedy, but it cannot give a direct access to a tag's content and cannot enable any modification of the XML document.
A parser enables for instance to display an XML structure, or to transtype an XML document to any of its dialect (exp.: from XML to XHTML in a RSS/RDF news system).
Online: (in a new window)
The DTD text is copied and pasted in the form. In the same form, a default name is given to the parser. After having sent the form, the generated parser is displayed. It then suffices to copy and paste it in a text editor before locally saving it.
The DTD file (*.dtd) is uploaded. In the same form, a default name is given to the parser. After having sent the form, the generated parser is displayed. It then suffices to copy and paste it in a text editor before locally saving it.
Include the parser file in the PHP code, then call the main function with the XML code to parse as first parameter and the chosen source encoding among "ISO-8859-1" (default value), "US-ASCII" and "UTF-8" as optional second parameter.
This application is public domain: you can use it online or download it. If you bring any modification to it you wish to share, the new version will be added on this site.
(modify consequently the parameters.inc file to use off-line)