spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / xml / column68

dtddoc step 4: Generating HTML

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

The PHP solution

The DTD parser in PHP is derived from the one in Java, so porting dtddoc is fairly straightforward. File operations are much more C-style in PHP, and iteration with foreach results in more compact and readable code. Availability of sort functions save us from having to manually sort the index, as in Java. Also worth mentioning is that PHP passes data structures by value, not by reference. This is also true with Java, except that Vectors and Hashtables are objects and are therefore passed by reference. Mind your backslashes in function definitions where you intend to modify the incoming data.

Here is the source code.

The Perl package

The Perl solution looks slightly different in parsing the DTD because of the callback approach to reading comments. Other than that the PHP constructs can be translated almost automatically to Perl constructs, carefully replacing $ with $, @, and % for the respective data structures. View the source code.

Differences in implementations

If you tried all three solutions you noticed slight differences that mirror the language's strengths or weaknesses:

Conclusion

We successfully implemented a first version of a DTD documentation tool in three programming languages. More languages might be considered should a DTD parser be available for those. A first documentation effort was completed with RSS version 0.91 and more will follow. I hope this effort will help you to better understand and more quickly identify DTDs that are relevant to your XML or SGML work!


Produced by Michael Claßen

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business

URL: http://www.webreference.com/xml/column68/2.html
Created: Nov 11, 2002
Revised: Nov 11, 2002