matth has asked for the wisdom of the Perl Monks concerning the following question:

Dear all, I have been going through CPAN XML module descriptions. I am quite new to XML and so have been a bit lost with the many modules available. The work I am doing requires the automatic building of XML documents. I am planning to use XML Schemas instead of DTDs. I understand that XML Schemas will surpass DTDs. Do people share this view? Also. Can people highly recommend any XML modules? At the moment I am coding everything without the use of XML modules. I build tab delimited tables of XML attribute data. My program then builds one node at a time with one table being used for one node level depth. Each row in the table creates a new node at a given depth. I think that I have found the easiest way of doing things without the use of XML modules but can anyone convince me otherwise?

Replies are listed 'Best First'.
Re: Automatic XML builds
by ajt (Prior) on Nov 29, 2002 at 12:53 UTC

    matth,

    XML Schema does have advantages over DTDs, but DTD technology is probably more mature and understood at the moment. I think only the latest XML modules therefore understand XML Schema.

    There are as you say quite a range of XML modules too use, for a quick comparison I would recomend mirod's Ways to Rome article as a good place to start.

    I rather like the GNOME based XML::LibXML module, it's very fast, fairly feature complete, very feature rich, and under active development. Others no doubt will suggest other modules.

    I'd suggest the following nodes to read, to see what people have said in the past:

    To give you an idea of ease and speed, I've written simple code that can take one big XML file and parse it to produce over 2000 XHTML pages, and hundreds of folders, in under 1 minute with LibXML and LibXSLT.

    Good luck!

    update: For XML Schema support check out XML::Schema from Andy Wardley.


    --
    ajt
      Thanks Ajit. That advice is helpful. Before I spend time on the XML::LibXML is there anybody else out there that would like to agree or disagree with Ajit's suggestion that XML::LibXML is the way to go?
Re: Automatic XML builds
by gjb (Vicar) on Nov 29, 2002 at 14:54 UTC

    As far as I know, there's no Perl XML parser that handles XML Schema. A few weeks ago I did a project which involved schema, so I had to work in Java (Apache Xerces). According to the libxml2 webpage, it doesn't support schema either, although it is in the works.

    XML Schema technology is well-supported and quite mature in the Java and C++ world, so it would be very nice if someone would do something about Perl's lack of XML Schema support (hint, hint, and yes, I know the standard reply to this, but I haven't got the time).

    DTDs are no match for XML Schema, especially with respect to data type validation. Structure is okay with DTDs, although schema offer superior flexibility.

    You might have a look at Apache's Xerces-Perl though. It was not an option for me unfortunately.

    Just my 2 cents, -gjb-

Re: Automatic XML builds
by valdez (Monsignor) on Nov 29, 2002 at 17:22 UTC

    I'm not sure I understood your question... You talk about building XML documents and then about Schema, but Schema is intended to validate documents...
    Anyway, if you need to validate some XML against a schema, there is XML::Schematron, which uses Sablotron or LibXSLT.

    Ciao, Valerio