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 ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Wednesday April 09, 2008
09:59 AM

Another Reason XML Annoys Me

[ #36111 ]

Consider these:

<foo></foo>
<foo/>

Yeah, they're equivalent, but I wish they weren't. The first could easily represent an empty string and the second could mean "undefined", but they don't. Sure, I could leave the tag out, but not if it's being validated against a schema which requires it.

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.
  • You know, if the schema requires the element to be there, it means that "undef" is not a valid value for the internal representation of that element. If it were, the schema should have declared the element as optional :)

    It's like you put a "NOT NULL" on database column, and then complain you can't put a NULL in it... (OK, XML and RDBMS are not that similar, but it was the closest example I could come up with)
  • I agree, but I have a real world problem. The client has agreed to send data which passes the schema, but they often send a lot of junk. As a result, we frequently don't know if they forgot to send something or if the information just really isn't there :(