Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TeeJay (2309)

TeeJay
  (email not shown publicly)
http://www.aarontrevena.co.uk/

Working in Truro
Graduate with BSc (Hons) in Computer Systems and Networks
pm : london.pm, bath.pm, devoncornwall.pm
lug : Devon & Cornwall LUG
CPAN : TEEJAY [cpan.org]
irc : TeeJay
skype : hashbangperl
livejournal : hashbangperl [livejournal.com]
flickr :hashbangperl [flickr.com]

Journal of TeeJay (2309)

Thursday January 08, 2004
02:21 PM

designing decent XML

[ #16715 ]

each time I come accross a piece of XML that I will have to parse, create or munge with perl I find that inconsitencies, duplication, shortcuts and bodges make something that should be trivial require nontrivial code.

for instance, I keep on finding text elements that contain values that have to be parsed in themselves, taking us back to csv or even binary formating - defeating the point of using XML.

Another annoyance is inconsistent structuring and naming, inconsistent naming can slow down understanding and development and encourage mistakes and confusion - inconsistent structures require different code for each structure rather than being managable.

Of course the XML should be organised based on the information or object it represents, but XML designers frequently forget that people dealing with it may a) not being using Point and Drool tools like XMLSpy, b) wish to map or transform the information to a different format, or manipulate or build it in a way different to how you initially imagine.

Much of the XML I see is the equivilent to poor functional programming and shows that little thought went into how it could be made easy to parse and easy to build with code. Badly designed XML mean that often its quicker to use bodges
and hacks (like regex's to extract information or using Template Toolkit to write XML) than to the use 'appropriate' tools.

I just wish people would look at their XML while they design it and think to themselves 'how easy will it be to parse, write, use a subset or extend ?'.

The one halfway decent XML style I have seen has been Dia, which avoids using text elements (which IMHO add un-necessary inconsistency to almost any XML), it is easy to parse and to write.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • My biggest problem with XML is nodes that contain mixed text and other nodes, like:

        <foo>
            <bar>
                Baz <quux>fizzle</quux> quuux!
            </bar>
          </foo>

    I always get very frustrated have to deal with <bar>.
    --
    (darren)