spacer

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

home / experts / xml / column68

dtddoc step 4: Generating HTML

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint

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