Saturday, May 21, 2011

XML Self Learning Start

In order to get the ball rolling on this thing, I decided a skill that might be useful that I kinda have, kinda don't have is XML. XML is an abbreviation for eXtensible Markup Language, and it is exactly that; extensible because the definition of an XML document can be changed to meet a particular user need; markup language meaning it is a language for describing information (as opposed to a programming language which is used for automating the problem solving process on a computer.)


Most XML documents are, in the study of formal languages called a Context Free Language, which, if it helps one to visualize, can be thought of as a Tree, in the sense that every piece of information has a singular parent, (save for the parent of the document) and can have none, one, or many children.


Under what circumstances does one generally use XML? XML is used mostly for storing information that will be read again, at some point, by some application. The application might be the same application; it might be an entirely different application. Because of the rules that define XML, it is extremely portable. Because of its portability, it is used often in web applications for sending and receiving information (Another competing format that is growing popular that is used in the same problem space is JSON which I might discuss later.)


In programming, XML is often created through serialization, a process that can be automated to take all the important information of a runtime object and save it into a file. This process is called serialization because it takes information that might be in any particular location and order in memory, and forces it to all be in one location in a specific order (That is serialized). Most programming languages also have deserialization facilities as well, allowing one to instantly put information back into a program from an XML file.


Another advantage to XML is that it can be easy for people to read if they need to read it, allowing software developers and testers to easily spot mistakes, for example, and seeing what might need to be fixed. This is called validation. However, even better than that, XML has built in support for validation through XSD, or XML Schema Document. Using an XSD, one is able to decide what is allowed in a particular document, and what is not allowed. Most XML programming language libraries and several IDEs and enhanced text editors can report if an XML document does not subscribe to noted preconditions, such as missing particular required values, having words in a spot where only numbers should be, or a mistyped phone number, for example. There are some criticisms to XSD and some short comings, but it can be used as a good first step to ensure meeting most preconditions.


In addition to XSD, we can also use XSLT or eXtensible Stylesheet Language Transformations to transform data from one format to another. For example, if information in one program is expected in one format, but the output from another particular program is not in that same format, an XSLT document can be used to automate the process of converting the output into the expected input of another program.


For now, I am going to use Serna Free as my XML editor because it is free and open source and runs on Windows, Mac, and Linux. I have not used it before, but it seemed to have respectable support from a precursory search. Other good editors that may work just as well are Notepad++ or the editors included in your IDE of choice. I chose to try this software because it looks like it might ease the testing of XSD and XSLT along with an XML document. I hope to learn something from this project, and I hope that this will help others as well. If anyone would like to recommend a particularly good free XML editor with built in validation and XSLT testing, please feel free to comment (says I to my absolute zero readership.)

No comments:

Post a Comment