Matt Sergeant writes: > > This assumes you need XML in the first place. > > No, it does not. The rest of my post spoke about XML as a > data format and set of tools, not as a syntax. Please stop > thinking about XML as syntax!!
If my entire system is written in Perl, why do I need XML as a data format? Perl's data structures are richer and have much more support in Perl than XML has in any language. Perl has been around much longer and is full-fledged programming language. It has better tools. It's got a larger community. > You seem to speak as someone who has never tried by the sounds of > things. This is one of the things AxKit's XSP taglibs are designed > to provide for. I've never used XSP. I have used XSLT, tried to use XSD, and am currently mired in DocBook/XML. One of my sites generates XML for its data export format. Let's take an XSP example from axkit.org: <xsp:structure> <xsp:include>Time::Object</xsp:include> </xsp:structure> <xsp:logic><![CDATA[ sub mytime { my ($time) = @_; $time ||= time; return Time::Object->new($time); } ]]></xsp:logic> Why is the above better than below? (I cleaned up the perl :-) use Time::Object; sub mytime { my ($time) = @_; return Time::Object->new($time || time); } Or, why can't I just call Time::Object->new where I need it? When I first started working with DocBook/XML, I thought there were all these great tools. When I tried to install dblite, it took me two hours and it still didn't work. I had to install a particular version of Java for the XSLT program. Fortunately, Perl was already installed, which dblite uses for glue. The *.xslt files have to be configured to be found by the XSLT program. And on and on it went. I said to myself, "Self, this is a trivial problem. Let's see how long it takes me to hack something in Perl." Two hours later I had a working DocBook/XML to HTML translator, which was good enough for my needs. Later I decided to make this into an example program. This new program processes about 50 different DocBook/XML tags and includes a word counter for XML files. It is 340 lines including comments and POD. Source: http://petshop.bivio.biz/src?s=Bivio::XML::DocBook Compare this to dblite which has 5400 lines of XSLT in 6 files and about 3000 lines of Perl to glue it all together. This doesn't include Sax or Xalan, which are the java programs you need to run XSLT. XML solves a problem through an indirection. It's very similar to CORBA IDL in that it is a language which is used as a least common denominator between heterogeneous languages/systems. This is a good use for XML. (BTW, if you look at the committees from the OMG and the committees in the XML world, you'll see a surprising overlap. I wonder if they'll be successful this time.) While every software problem can be solved through another layer of indirection, every layer of indirection also creates a new software problem. Rob