you’re on your way 4
345
xml requests and responses
Filling that XML prescription
Trying to come up with a data format that works for the server, that the browser
understands, and that won’t have to change if Katie adds another product line or changes
the order of items on her report... that’s not so easy.
Luckily for us, Dr. Zigmund (as well as that rather impatient girl on the last page) seems
to have a solution: XML, the extensible markup language. Using XML, we can come up
with a simple response format that is clear, and contains all three updated sales totals.
Q:
What’s so great about XML?
A: The biggest thing going for XML
is that it’s a recognized standard. Some
folks at the World Wide Web Consortium
(or the W3C for short) define what makes
XML, well, XML. And since most people
agree to abide by the W3C standard,
browsers, servers, and programs like PHP
scripts can all use XML without wondering
what a bracket or a semicolon means.
Q:
I still don’t see why it’s so bad
to just make up our own data format.
Wouldn’t that be easier?
a: It might seem that way, but
proprietary data formats—formats that
you make up for your own use—can
really cause a lot of problems. If you
don’t document them, people forget
how they work. Even worse, some of
the characters you might use, like a
semicolon or comma, can have more than
one meaning, and they make the format
confusing to programmers.
Q:
I g ...