Slashdot Mirror


Effective XML

James Edward Gray II writes "I'm not an XML junkie and I thought this was a very good book, so I'm betting that XML aficionados will love it. Effective XML covers 50 best practices that all developers should know and use. This amounts to a book of distilled wisdom that will push you a good distance up the chart of XML mastery." Read on for the rest of Gray's review. Effective XML author Elliotte Rusty Harold pages 304 publisher Addison-Wesley rating 8 reviewer James Edward Gray II ISBN 0321150406 summary A guide to the correct use of XML.

Before I tell you what's inside though, let me tell you what you won't find in these pages. Primarily you need to know that this book does not teach XML. I know a lot of books say that, yet still include an introduction or appendix that covers the basics, but this isn't one of them. You're expected to know XML from page one. Even syntax is only covered from a proper usage angle. Personally, I appreciated this. It always bothers me when an obvious non-beginner's book starts off by wasting a chapter on things I should already know. You just need to be aware when you buy that you won't learn XML here. Knowledge of namespaces, DTDs, the W3C's Schema Language, XSLT, and more aren't strictly required to get something out of this book, but they certainly would help you get a lot more out of it.

What you will get here is coverage of fifty miscellaneous topics spread across four sections on "Syntax", "Structure", "Semantics", and "Implementation". In "Syntax", ten topics delve into the details of things like DTDs, entity references and the XML declaration itself. It may sound silly to dig deep into a single line of XML that simply declares the format, but I doubt you will think so after reading that topic. There's a lot going on in that line and you want to be in control of those decisions instead of just copying and pasting. Entity references are an even smaller chunk of XML output, but they too get illuminated by a rare insight on how and when they should be used, and for what. Did you know that it is possible to write a namespace savvy DTD? I do now and I learned that in this section as well.

The second section of the book covers "Structure", and to me it was the best part. This collection of seventeen topics is loaded with good advice about how to build an XML document that will be ideal for anyone who needs to work with it. Here you see how metadata should be stored in XML, get tips on embedding binary content, learn which schema language is better for which tasks, and finally understand rare XML constructs like processing instructions and exactly what they are for. Additionally, there's a lot of general advice on the right way to mark up content that's really worth its weight in gold. Just one example of what I learned here is that I under appreciate mixed content for great constructs like <name><given>John</given> <family>Doe</family>, <title>Ph.D.</title></name>. If you like that, you'll enjoy this whole section.

Section three, "Semantics", deals primarily with parsers and their APIs. Again, you won't learn any APIs here. What's covered is their strengths and weaknesses and why you should choose a given API for a given task. SAX and DOM are the main focus of these ten topics, but there are other details sprinkled in, like XPath.

The fourth and final section is all about "Implementation". The thirteen topics here address client-side XML styling, server-side transformations, signatures, encryption, compression, and more. My favorite topic here was a terrific coverage of Unicode and how it affects XML. All developers should know at least as much about Unicode as what's printed here and this is a fine source to learn it from.

One thing that really stands out in the whole text is that the author isn't afraid to cover the dark side of XML. He will tell you where the design process was less than perfect, which tools have little practical value, and some of the problems with where XML technologies are headed. This isn't complaining though. All of this is targeted at how it affects XML developers today. You learn what you can safely skip and what should be outright avoided. The author even tells you what XML is bad at and gives you advice about when you shouldn't use it. That's the mark of a man who knows his subject, if you ask me.

All told, I think the author failed to completely convince me his way is perfect on only 2 topics. That means I learned 48 expert XML tricks. Surely that's worth the cost of the book in time and money. This isn't the first XML book you need, but I think it is the second XML book everyone should read.

You can purchase Effective XML from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

53 of 269 comments (clear)

  1. Binding by 2.7182 · · Score: 3, Funny

    I love the book, but once it encountered a humid day the binding fell apart. Anyone else have this experiance ?

    1. Re:Binding by Monkelectric · · Score: 2, Funny

      I once tried to "dry" a book that was rain soaked in the oven at very low temp ... my father turned the oven up to preheat some food ... physics book al larange

      --

      Religion is a gateway psychosis. -- Dave Foley

    2. Re:Binding by xaqar · · Score: 5, Funny
      physics book al larange

      Surely you mean physics book a lagrange ...
  2. The Problem With XML by osewa77 · · Score: 5, Interesting

    Is that it's not a very machine-friendly language (more wordy than it ought to be; parsing of tags is not very efficient) and it's not a very human-friendly language (the human style is free-style, really). I don't think it's a very good universal data description language. sorry that I had to go on a bit of a tangent...

    1. Re:The Problem With XML by Further82 · · Score: 4, Insightful

      They are supposed to be written so people can make programs to read the data without spending hours reading huge cryptic implementation manuals. You forget that computers do not program themselves yet. People still need to do that and XML is easier for people to read and thus easier for them to make programs to read. When machines can program themselves...we wouldnt be having this conversation.

    2. Re:The Problem With XML by cluckshot · · Score: 3, Interesting

      To be specific having spent the last 3 years working on XML I can suggest that there are numerous problems with XML.

      XML Tagging is tedious and stupidly top heavy in overhead. Contrary to being human friendly it isn't. XML Tagging should be shortened to a simple set of defined tag names and then type definitions. After that each name would be addressed by an index. Typing of data should be contained in a process to extract that is associated with either the tagging index or an over the top wrapper which is similar in function to the DTD. But frankly the whole process is currently a mess.

      The expansion of data with tagging currently can be as much as 3 or 4 to one. This is because of the recursive parsing process if you are recovering data a gemetricly expanding time consumer. If you use linear display the process is nearly worthless for anything but a single display process. It works great for short things. In short it just eats up processing time and band width. It makes a good universal file storage structure and that is it!

      Once the file is retreived it should be crunched into something like MySQL or such if any real processing is going to happen.

      Nothing really is gained by such a markup system over just a series of hashed tags that are indexed. Such tagging and indexing is a lot less of a tax on band width.

      This having been said, XML works and is OK for many uses. I am not sure it really has any advantage over flat files or such. It drinks band width and program operations time. I think in time it will turn out to be a fun toy but not much else. Of course someone else might find a good way to tell me why I should use 40 characters to transmit what should have taken 10 characters and how it should have been faster or more efficient some way to use it. The whole concept was definitely good for a lot of programmer payroll time.

      --
      Never Politically Correct ~ I prefer the facts If you don't like what I say, get a life, or comment yourself.
    3. Re:The Problem With XML by Further82 · · Score: 2, Informative

      point is string parseing is neither easy for the programer or the machine. Compare finding a specific set of data in XML with its variable length branching sets of elements etc. to finding somthing in a SQL database where all data is at fixed offsets. With SQL the computer only needs to know how big each row is, and what row its looking for, then it can skip to (size of row)*(row number) just like that. That's fast. With XML, the whole file has to be parsed first, then once its in memory a faster lookup can be done. I'm not sure how XML databses work, but they look like they would aleiviate this problem.

    4. Re:The Problem With XML by pyrrho · · Score: 2, Insightful

      one of the original ideas of XML was that a simple (SAX like) parser can be written by "a graduate student in two weeks".

      The validation etc is more difficult, but then it's not a matter of parsing the XML in the first place.

      It matters what you mean, but in general XML is easily parsed by machines... and easily represented in internal datastructure which are however efficient you make them.

      --

      -pyrrho

    5. Re:The Problem With XML by Procyon101 · · Score: 4, Funny

      I think that I shall never smell
      A standard worse than XML.
      A standard I am loath to use
      Though offered parsers to abuse;
      The designers couldn't pass a class,
      CS201 can kiss their ass;
      A structure no one can traverse
      pre and post order routes are cursed;
      What are it's types you cannot tell;
      Though it promised self referential.
      Standards are assigned by committee,
      But any fool can make a tree.

    6. Re:The Problem With XML by eap · · Score: 4, Insightful
      Of course someone else might find a good way to tell me why I should use 40 characters to transmit what should have taken 10 characters and how it should have been faster or more efficient some way to use it. The whole concept was definitely good for a lot of programmer payroll time.

      I would not be so quick to dismiss XML because of traditional arguments. Having worked with several different ways of storing and transmitting structured information, I can say without question XML comes out easiest in the end.

      If you're only transmitting 10 characters, then yes XML is not for you. However, if you're describing dynamically changing, complex data, even in large amounts, XML is very handy.

      There are turnkey parsers for XML that are well tested and which allow the client to see an abstracted view of the data as an object, at any level of detail desired.

      Platform independence is built in.

      It's easy to syntactically validate XML, as it's done automatically. It's also easy to isolate logical validation into discrete units since XML couples easily to object oriented designs.

      Very large XML messages can be processed quickly using a pull parser. Pull parsing is faster than SAX and has the intuitive benefit of being client driven, not event driven.

    7. Re:The Problem With XML by dustmite · · Score: 2, Interesting

      In my experience the main reason our clients want their data in XML is that most of them are afraid of single-vendor lock-in to proprietary formats, especially to smaller vendors they perceive could more easily go under - in other words, they want data longevity and a format they can easily process their data if they need to. And this trumps the inefficiency. Especially as people mostly transfer such documents across high-speed LANs and store them on modern 120+ GB hard disks and open them on machines with 512MB+ RAM ... in all of which cases inefficiency doesn't cause any problems.

      There are also generic XML content editors which, although rather pricy, help reduce a lot of the negatives associated with working with XML (i.e. you would be crazy these days to be writing XML in e.g. Notepad).

      I personally agree that XML is overrated, but many people want it because they understand one thing: if their data is in XML format, you can't in the long run lock them in to your software with excessive prices, and if you disappear, they can still get their data.

    8. Re:The Problem With XML by redhog · · Score: 2, Informative

      Because you need to _parse_ it in any way at all. Simply holerith/runlength-encoding the data would be much better.

      Take XPath as an example. How do you extract the fragment pointed to by the expression

      foo/bar/fie[@naja='hehe']

      ? You read the document, counting opening and closing tags, until you read in a foo-tag at topp-level then you continue, counting as before, until you, before a foo-ending tag at topp level, reaches a bar-tag at second level, and then until you reach a fie-tag with the attribute naja set to 'hehe' at third level. Then you read on counting opening and closing tags until you reach its ending tag and return the string between the opening and ending tags, including those tags, as result.

      Thus, if the foo-tag is at the end of the document, yoy have read the entire document just to extract those tiny bytes at the end of it.

      If you coded each tag something like

      4711 characters

      this task would directly be greatly minimized, as you could "jump" over big chunks of the file at once. Changing the coding of that 4711 to binary would also minimize the hassle, as reading the number would be a simple 4 byte read operation (one machine instruction).

      Even better would be to have tags not contain any information, but just pointers (indexes into the file) to the information, so that changing the file destructively to add some extra info would be possible without re-writing the whole (possibly big) file.

      All of this is old knowledge however. Go read up on SUN RPC, Corba, or, heaven forbid, ASN.1...

      --
      --The knowledge that you are an idiot, is what distinguishes you from one.
    9. Re:The Problem With XML by Proc6 · · Score: 4, Insightful
      This is like comment #492 that XML is slow and a poor format to use for databasing.

      People are trying to use XML for something other than for which it was intended then complaining at the sub-standard results. Surprise? XML is a common format to make it possible to move data between different, I'll use the word "domains" (as in division not URL), it should be used for "just" that.

      In other words, XML should be a "transport" mechanism. It's so I'm not writing a new parser by hand everytime some wanker like you sends me a file in yet another made-up-on-the-spot type. Your example is relatively clean but in the real world as the data gets harder to describe, humans start to make more ignorant made-up-on-the-spot rules like "Well ok if theres a sub record the line will start with a -, well ok it could be a + too, if the subrecord can only contain numbers... no you know what lets make it -n if the sub records can contain numbers only..". No matter how ingenious your "format" is, the problem isn't your format, its that your format isn't my other customers format.

      XML should be used in scenarios where the time spent being able to use all the readily available XML parsing and validating tools you don't have to re-invent the wheel writing is more than the milliseconds saved parsing a longer document "once".

      Don't use XML as your main, permanent, datastore for a gigantic database and complain. It's not for that. Its for when I need a copy of your data and I don't want to pay for a copy of "JackoffDb version 5" that you run, or hire a team of programmers to write a translator just to read your files. Gimme XML, I can take that and understand its contents and schema with ease, then Ill import it into my own system here.

      --

      I'm Rick James with mod points biatch!

    10. Re:The Problem With XML by EddWo · · Score: 2, Informative

      Sounds like you've been reading Joel.
      http://www.joelonsoftware.com/articles/fog00000003 19.html

      --
      "Taligent is still pure vapor. Maybe they'll be the last who jumps up on Openstep... "
    11. Re:The Problem With XML by sapgau · · Score: 2, Interesting

      Yes, that's implementation.

      But the question was if it is a universal data description language. Sending binary will kill your data the first time you try to comunicate to a macitosh or Unix system (big endian, little endian).

      The common lowest denominator is just text, so to describe any structure we have trees in XML.

      Probably the confusion is the influence of Object Oriented design with Entity Relationship schemas in databases. The way that one-many relationships are described in both areas makes sparks fly.

      Pivoting on table data is what OO makes it look easy but complicated in ER. For these kinds of problems XML is just the messenger.

      I might be wrong but doesn't Oracle allow you to return data in xml format? I wonder how efficient that is.

  3. Join the Dark Side by TripMaster+Monkey · · Score: 2, Funny

    One thing that really stands out in the whole text is that the author isn't afraid to cover the dark side of XML.

    [Obligatory Star Wars joke]

    --
    ____

    ~ |rip/\/\aster /\/\onkey

    1. Re:Join the Dark Side by TripMaster+Monkey · · Score: 5, Funny

      XML: You killled my father!

      HTML: No, XML....I am your father!

      XML: That's impossible!

      HTML: Grep your code...you know it to be true.

      XML: NOOOOOOOOOOOOOOOOOO!

      --
      ____

      ~ |rip/\/\aster /\/\onkey

    2. Re:Join the Dark Side by johndiii · · Score: 2, Informative

      HTML significantly predates XML. Though both are derived from SGML, they are in somewhat different categories (HTML being an application of SGML, while XML is a profile). HTML is a closed development path, however; future versions will be XHTML, which is a derivative (application) of XML.

      --
      Floating face-down in a river of regret...and thoughts of you...
  4. damn by pyrrho · · Score: 5, Funny

    I want to say something funny about XML, but there is nothing.

    --

    -pyrrho

    1. Re:damn by Ivan+Todoroski · · Score: 5, Funny

      I completely agree with you .

    2. Re:damn by charlieo88 · · Score: 2, Insightful

      HA! I'd mod you up if you weren't already maxed out.

  5. n00b - help! by dsginter · · Score: 4, Interesting

    After seeing what can be done with simple javascript and XML, I'm wanting to get into this. Can someone point me to the best OSS way to do this (I can hear the groans now). I like Postgres but I don't see much in the way of getting it to spit out XML. I like documentation... MySQL? Am I missing something?

    --
    More
    1. Re:n00b - help! by aldoman · · Score: 5, Insightful

      XML is totally overhyped, which sadly makes people think it is a lot more complex than it is.

      Think of it more like CSV than mySQL. It's just a format for representing structured data. It also happens to be that it's quite easily read by humans.

      Yes, you can do incredibly advanced things with XML, but there is nothing you can do in XML compared to your own propietary data storing language.

      The reason people use XML instead of writing their own data storing format is simple:- there is a lot of tools for parsing it, which you'd have to write yourself if you had your own format.

      As for the javascript and XML example, it's impressive, but it's far more javascript than XML.

    2. Re:n00b - help! by Piquan · · Score: 5, Insightful
      The coolness of XML is not in the format (which sucks); it's in the technologies around it.

      RelaxNG, for instance, lets you verify that your XML file is built correctly for your app: you write a RelaxNG spec for your XML file format, and then it verifies that all the mandatory fields are there, in whatever order is necessary, with the correct datatypes, etc, etc. RelaxNG processors are part of most major XML libraries now, so if you're writing Perl you can just tell your Perl library to validate your file and it's done. If you're editing in Emacs (with nxml-mode), you can point Emacs at your RelaxNG file, and have tab completion, error highlighting, etc, etc-- all customized for your file format.

      XSLT lets you take an XML file and perform transformations on it into another (possibly XML) file format. Need to convert XML into SQL INSERTS? Piece of cake. I use it to extract particular parts of an XML file and convert them into a significantly differently-ordered Lisp structure.

      Most modern web browsers are becoming CSS engines rather than HTML engines. So you can stick a CSS stylesheet reference at the top of your XML file, and have the CSS generate something that looks like what you want the user to see. The data file looks good to the app, and looks good to the user. You can also (with some browsers) use more powerful transformations using something like DSSSL or XSLT.

      DOM for a standard data manipulation API, so each program you write doesn't have a different data access language. XPath as a language to perform more complex queries. XML Namespaces to let users or apps tag their data with extensions. XInclude for data sharing. All of these are things you get for free with XML.

      All of these are general technologies, not specific apps. So they should be usable in most major libraries in most languages. (If you're using Perl, I'd recommend XML::LibXML.)

      Don't think of XML as just a file format, because that part sucks. Think of it as a buffet table of technologies. When you write a program, 10% is to do the program's processing; the other 90% is to handle I/O, data management, and other housekeeping. Using XML lets you get a lot of that for free.

      PS: I'm not an XML fanatic. A year ago, I was told to use XML for one particular project and was disgusted at the idea. I still think that XML gets a lot wrong, but I've come to recognize what benefits XML provides.

    3. Re:n00b - help! by Doctor+Faustus · · Score: 2, Funny

      XSLT lets you take an XML file and perform transformations on it into another (possibly XML) file format. Need to convert XML into SQL INSERTS? Piece of cake. I use it to extract particular parts of an XML file and convert them into a significantly differently-ordered Lisp structure.

      I really like XSLT for code generators, with the meta-data in XML. I do, however, miss the sheer perversity of using Access VBA to generate Java.

  6. Hey, come on... by Anonymous Coward · · Score: 5, Funny

    XML is all about loosely bound interfaces.

    Get with the program.

  7. Dear XML-Junkies, by Letter · · Score: 5, Funny

    <letter>
    <salutation>Dear XML-Junkies</salutation>
    <body>
    I type all my business letters in <link href="http://www.google.com/?q=XML>XML</link>. Sometimes it can be a bit <link href="http://dictionary.reference.com/search?q=ver bose">verbose</link>.
    </body>
    <signature>
    <name ><nickname>Letter</nickname></name>
    </signature>
    </letter>

    1. Re:Dear XML-Junkies, by refactored · · Score: 2, Funny

      nsgmls:letter.xml:1:0:E: no document type declaration; will parse without validation
      nsgmls:letter.xml:4:78:W: character "" is the first character of a delimiter but occurred as data
      nsgmls:letter.xml:4:78: open elements: letter body
      nsgmls:letter.xml:4:114:W: character "" is the first character of a delimiter but occurred as data
      nsgmls:letter.xml:4:114: open elements: letter body
      nsgmls:letter.xml:4:132:E: net-enabling start-tag not immediately followed by null end-tag
      nsgmls:letter.xml:4:132: open elements: letter body
      nsgmls:letter.xml:4:46:E: literal is missing closing delimiter
      nsgmls:letter.xml:4:46: open elements: letter body

  8. XML Seems Cool by Aknaton · · Score: 2, Insightful

    XML seems cool to me. I like the thought of being able to design a schema to suit my personal needs. But when it comes time to make use of that schema and actually keep data in it, it seems to be useless, as least as far as an end user (non programmer) is concerned.

    Do I have the wrong impression?

    1. Re:XML Seems Cool by gizmofan · · Score: 2, Insightful

      XML is a way of decorating data with meaning but it's not the most efficient or effective way of doing it. From a software point of view it's expensive to parse - incredibly so when heavily nested/structured and just in terms of size it can be huge in terms of the raw data that it's actually transmitting. The main problem I have with the way XML is often used is the fact that's it's the worst of both worlds. It documents the data that it encapsulates badly from a human point of view (it's difficult to read and repetitive) and verbosely from a machine point of view (ditto). Why not use something more apt from a machine point of view (lisp s expressions?) and something more apt from a human point of view (a document?).

    2. Re:XML Seems Cool by Creosote · · Score: 2, Insightful
      XML isn't really "useless", but keeping data in XML files is probably a bad idea. What if you mistype one character in one tag for instance? What does your document mean now?
      This is sort of like saying that programming in C is a bad idea, because what happens if you mistype a function name, and your program refuses to run? That's what debuggers are for. Likewise, the XML world is full of open-source or low-cost schema-aware editors and validators. Minimally you should use an editor that knows which elements and attributes are legal while you're entering data. If you design a schema appropriately for your data, you can constrain data types with a great degree of precision.
    3. Re:XML Seems Cool by elharo · · Score: 2, Informative

      Please don't tar XML with the schema brush. One of the unique innovations of XML is that schemas are optional, and need not be agreed on. Schemas can be useful as I discuss in Item 37. However, they are misused and overused far more often than they're used correctly.

      Really, schemas are just convenient tools for a few special purposes. Not everyone needs them, and no one needs them all the time. Schemaless XML is a lot more interesting and practical.

  9. Yes, it's a great book ... so far by page275 · · Score: 2, Informative

    I just bought a book a couple days ago. Great one so far, even it does not teach you XML, but for anyone who have even small experience with XML, the book is still great. Just like me, you will pick up really fast.

  10. FYI by Anonymous Coward · · Score: 5, Informative

    Bookpool has it for $28.50. Don't click the bn sponsored link (where it's a whopping $44.95).

    PS, I don't work for Bookpool, I hate it when /. gets a kickback from doing something dumb like clicking the link to overpriced merchandise.

  11. Try the other "Effective" books, too by Eric+Giguere · · Score: 4, Informative

    If you like this book, don't forget to check out Scott Meyers' Effective C++ or Joshua Bloch's Effective Java. Both are great. I devoured Meyers' book when it first came out, and I was happy to see Bloch's book was similarly useful. There is also an Effective Perl book out, but I don't know how good it is -- it follows the same general format, but hasn't been updated since 1997. (Neither has the C++ book, but C++ hasn't changed that much since then.)

    Eric
    See your HTTP headers here
  12. Just because you CAN... by IGnatius+T+Foobar · · Score: 4, Insightful

    Sometimes, the most effective use of XML is to simply not use XML at all. XML is a wonderfully useful tool when applied correctly. It's architecture-independent and is a great way to communicate unstructured and/or hierarchial data.

    Sometimes, though, your data can be simple enough that XML is overkill. Software developers need to make themselves aware of situations when they might be better served by a simple "flat file" of delimited data. In situations like this, using XML can amount to what I like to call "gratuitous complexity."

    Always use the right tool for the job.

    --
    Tired of FB/Google censorship? Visit UNCENSORED!
    1. Re:Just because you CAN... by elharo · · Score: 2, Informative

      These days data has to be pretty damn simple to justify using a flat file rather than XML. I wrote more about this in my previous book, Processing XML with Java than in this one, though. Chapters 1-4 discuss this in some detail.

      Real-world data often gets messy in ways that don't lend themselves to flat files. For instance, two of the thorniest problems:

      1. How do you handle encoding detection and international characters?
      2. What do you do when the data contains characters you're using as field delimiters?

      Both of these are completely solved by XML with no extra effort on your part, and these are hardly the only issues.

      I certainly agree that it's easier to write a parser for a flat file format than it is to write a parser for XML. However, it's much easier (and much more reliable) to use one of the existing well-tested, debugged XML parsers than it is to write your own flat-file parsing code.

  13. overstock by Quiet_Desperation · · Score: 2, Informative

    $28.27 at overstock.com.

  14. Re:Bah by Anonymous Coward · · Score: 4, Funny

    The essence of XML is this: the problem it solves is not hard, and it does not solve the problem well. - Phil Wadler

    XML is not the end of our problems, it is the beginning of our problems. - ditto

    Shortly after the release of XML, some folks, including some very important folks in W3C and its members, who had been big supporters of XML, actually got around to reading the spec, and discovered to their horror that they had an XML which included entities, DTDs, PIs, and assorted other baggage. - Tim Bray

    When XMI came out, I had just been studying up on UML, and I thought "Cool! I'll print out the DTD so that I can look it over on the subway ride home!" When I saw how big the XMI DTD was, I decided not to print it out--I prefer not to spend that much time in the subway. - Robert DuCharme

    XML was monocase until quite late in its design, when we ran across this ugliness. I had a Java-language processor called Lark - the world's first - and when XML went case-sensitive, I got a factor of three performance improvement, it was all being spent in toLowerCase().- Tim Bray

    XML-based technologies seem particularly susceptible to the "if we standardize it, everyone will use it" fallacy. - Simon St. Laurent

  15. Re:Really? by sosume · · Score: 2, Insightful

    I'm more interested in using XML as a means for language independent object persistence (not just cheesy .NET XmlSerializer class stuff either). How much coverage of such things is there in the book? Ie; creating an object in Java on one machine, persisting it and it's state to an XML file, and recreating it on some other machine in C++ or C#. I'm tired of writing my own "protocols" to migrate running code from one app to another.

    You have obviously never looked into soap, which seems to be able to address every requirement you are describing.

    But, not using Soap is quite common on Slashdot ;)

  16. Re:hmmm by computational+super · · Score: 2, Informative
    Although I will probably never get why a closing tag requires a repeat of the file opening tag name

    Not sure if you were serious here or not, but this is necessary to disambiguate the following improperly formed XML:

    <start> Now is the time for all good men to come to the aid of their <noun>country</noun></phrase>

    which is either missing a "phrase" start tag or mixed up the start & end tags... in a long XML document, the parser can give you a better hint where to look for the error.

    Or you were kidding and I missed the joke, in which case I'm about to be called all sorts of impolite things... (I might even be referred to as Sean Penn).

    --
    Proud neuron in the Slashdot hivemind since 2002.
  17. A perfect eXaMpLe of a good use for XML by swrider · · Score: 5, Funny

    There are valid uses for XML. Just look at http://www.x-cp.org/

  18. Re:hmmm by elharo · · Score: 5, Insightful

    Ever try to debug deeply nested LISP in a plain vanilla text editor? Ever try to find exactly which closing parenthesis is missing where? That's why end-tags have names. It's pure human factors. Computers don't care about this. People do.

    SGML (XML's precursor) did have minimized end-tags like . Experience proved this caused more pain than it alleviated. Hence the lack of minimized end-tags in XML.

  19. Delicious irony by dubbayu_d_40 · · Score: 3, Funny

    ridiculing the verbosity of xml, on a web page.

    1. Re:Delicious irony by owlstead · · Score: 3, Funny

      Yeah, but this is slashdot HTML, as far away from XML as it can be.

  20. Re:Disgruntled with XML.... by elharo · · Score: 2, Informative

    Hmm, that's one I haven't been asked before.

    I suspect what it offers is that you don't have to define and write your own BNF grammar, and then implement it in lex and yacc or similar tools.

    Grammar design is non-trivial, especially if you need to consider issues like internationalization. Picking XML as the underlying format means you don't have to do this work yourself. Why reinvent the wheel?

    Sometimes you do need something different, but a lot of alternative formats don't really have a good reason to exist. More often than not, custom parsers just come about because a programmer is more comfortable writing bad parsing code quickly than learning a new, more robust API in order to use someone else's parser.

  21. so do we love or hate Mozilla and FireFox today? by roman_mir · · Score: 4, Insightful

    After all XUL and RDF together with js, css and resource files - that's what makes FireFox tick.

  22. Re:Really? by elharo · · Score: 2, Interesting

    There's a very real tension between making examples too trivial to be interesting and making them too long to be readable. I struggle with it in every book I write, and every other programming book author I know does so too. I've tried putting so-called real-world examples in books, and it's hopeless. It can't be done. There wouldn't be any space left for the explanatory text, nor would anyone put up with reading page after page of code.

    Most importantly, while I tend to be writing about just one topic at a time, real world programs wander all over the map. I may be trying to explain how to use callbacks in SAX, but a realistic program also has to consider network latency, GUI design, error logging, numerical algorithms, internationalization, and a hundred other things that aren't on topic. Covering them all would obscure the subject I'm actually trying to explain. Some things you just have to leave for other books and other authors.

    As an author, I try to strike the right balance between excessive simplicity and excessive length. Sometimes I hit it. Sometimes I don't. I actually think Effective XML hits it fairly well. In fact, this book was one of the toughest I ever had to write, precisely because it was so short that I couldn't spew pages like I did in Processing XML with Java (1100 pages) or the XML 1.1 Bible (1000 pages). I had to be really picky about how much code I included, and make sure that each example carried its weight, demonstrated just the point at hand, and nothing else.

    By the way, the chapter with that specific example is online if anyone cares to see for themselves just what it is that makes names a more interesting and complex problem than "John Doe Ph.D" seems to be at first glance.

  23. What's so bad about XML? by rikkus-x · · Score: 3, Insightful

    I give customers a specification showing how I would like data sent to me. They can use the specification to tell them how to store their data, because they can read it. They can check that their data matches the specification, because their machine can read it.

    When I receive their data, I can check that it matches the specification, because my machine can read it. If there is something wrong with their data, I can point out where it's broken, because it's human-readable.

    Writing specifications is easy. Writing generators and parsers is easy. The tools are ubiquitous. Generation and parsing are usually fast 'enough'. The standards are freely available. Complex data structures may be described. Data may be transformed using a common language based on XML itself.

    Yes, I'd like it to be easier to write XML parsing tools. Yes, I'd like it to be easier to write tools which handle XML more efficiently. No, the two points above don't make XML the devil's data encapsulation.

    Rik

    1. Re:What's so bad about XML? by Xorkid · · Score: 2, Insightful
      Nothing,

      People just fail to realise what XML is (or isn't). Basically XML is just a way for you to define your own (markup) language for any purpose.

      That it. Is not a database replacement. It won't walk on water or feed the hungry or kill all the communists/terrorists.

      But if you want to persist textual data with structure, in a form that will most probably be readable in 20 years time, XML is for you.

      --
      www.microsoft.com/athome/sec urity/children/kidtalk.mspx Was This Information Useful?
  24. XML as a fall-back standard by galdur · · Score: 2, Interesting

    When it comes to speed, XML sucks. It does provide incomparable interchange of data on a human- and machine-readable level. It would be nice on the other hand to be able to select a faster standard when both ends of a transaction support it. XML would become the lowest denominator.

  25. I believe you meant... by game+kid · · Score: 3, Informative

    ... but yeah, you're right. Helps do away with the (ugh!) parenthesis matching crap in LISP, so actual people can edit it too, verbose as it may seem.

    --
    You can hold down the "B" button for continuous firing.
  26. Importance vastly overstated by s88 · · Score: 2, Informative

    The review almost sold me on the fact that I could actually learn something from this book. Looking at the sample chapters here told me the truth