Another Reason XML Annoys Me

Ovid on 2008-04-09T14:59:46

Consider these:


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.


Validation, schema, and undef

dakkar on 2008-04-10T08:56:08

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)

Schemas

Ovid on 2008-04-10T09:39:00

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 :(

Re:Schemas

Aristotle on 2008-04-10T15:12:07

That seems to me to say more about the client’s code than about XML.