153: Data: XML Extensible Markup Language.

Take Up Code - Un pódcast de Take Up Code: build your own computer games, apps, and robotics with podcasts and live classes

Categorías:

XML was designed to solve two main purposes. To allow information to be stored and transported and to allow both humans and computers to read and modify the information. Listen to the episode or read the full transcript below to learn more about how information was described and transferred before XML. As for XML itself, let’s say you want to record a phone number in XML. You could start out with an opening tag called phone. The tag name is readable and clearly identifies the intent. It’s also surrounded by opening and closing angle brackets. You know, the less than and greater than symbols. After this opening tag and the brackets comes the actual phone number. The phone number can be formatted however you want. You could even include enough numbers to add a calling card if you want. There’s no need to worry about running out of a fixed and defined number of characters. Unless of course, that’s how you want it. It’s up to you. At the end of the phone number comes a closing tag that matches the opening tag’s name. This makes it really easy to spot where a phone number begins and where it ends. Inside the opening tag, you can add what are called attributes. These are really nothing more than a name and a value. Maybe you could have an attribute called type and set its value to the string mobile. Need another phone number? No problem, just start a new opening tag called phone, put any attributes that describe the phone number inside the opening tag, then put the phone number, and close it with a matching tag at the end. And program that consumes XML doesn’t read fields located at specific starting and ending locations. Instead it looks for these tags. This means you can add new tags or even leave some out if they’re optional. You get to decide how to format your information and that format becomes part of the overall XML document. Transcript I remember working for a bank once a long time ago and helped develop an electronic banking application. There was a lot of information that had to be sent back and forth between the bank’s computers and the customer’s computer running the banking application. It wasn’t much different from an ordinary online banking website that you can log into today with any bank. But back then, it was new. I want to focus the episode today on how data can be formatted and described and compare one way to do this, XML, with how I remember organizing data back then. This is useful for distributed computing. After all, if you’re going to process information on multiple computers, you’re going to need some way to get that information from one computer to another. This is also useful though anytime you need to organize information into a format that you can later make sense of. Back when I was working on the banking application, there were documents that described the format of information. But let’s go even further back in time. How did businesses operate before there were any computers at all? This might seem simple but I’ll tie it all together in just a moment. Forms on paper were used. Actually, they’re still used these days and probably will be for a long time. I’m talking about papers with boxes and labels inside the boxes that describe where to write your name, address, phone number, and if you’re buying something, then the inventory name, description, cost per item, how many you want, total cost, taxes, shipping, and grand total. A company would send a purchase order with information like this filled out to some supplier. The supplier would need to read this and make sense of what the customer wants. Remember that the customer is sending a form designed by the customer and the supplier may be seeing this form for the very first time. The supplier might decide to go ahead and ship the purchased items along with an invoice or a bill requesting payment. This invoice would be printed on its own form.

Visit the podcast's native language site