XML stands for Extensible Markup Language. This form of computer programming transports and stores data as a text file but does not display it. For the data to display, XML must work in conjunction with another language such as PHP, JavaScript or HTML. Data, stored in a tree structure, uses elements designed and named by the person writing the document. Writing data into an XML file is a straightforward process that just about anyone can master with a little practice.
Step 1
Open a text editor. To write XML documents you can use a standard text editor such as Notepad. Click on the "Start" button located at the bottom of your desktop. Select "All Programs," then "Accessories." Click on "Notepad" to open the program.
Video of the Day
Step 2
Make your declaration at the top of the page. An XML declaration gives the program running your page instructions. A standard declaration starts with <?xml, lists the version and ends with a closing tag. An example of a declaration might look something like this:
The declaration should always be the first line of any XML document.
Step 3
Set up your tree structure with a root element and child elements. The tree structure is the heart of the XML language. A root element is the first line of your tree and it defines or names the data stream you are writing. For instance, you might want to name the category of a product like music as your root element. To do this, your first line would be
Step 4
Check your tree for any errors, such as missing tags. Remember, all elements must have a closing tag.
Step 5
Save your file in the XML format by using .xml as the extension. In most programs, this means clicking on "File" located in the software menu at the top of the screen. Select "File," then "Save As." Type in a name for the file and end it with .xml. The document will save to your hard drive as an XML file. For instance, a music catalog created in XML might be "music.xml."
Video of the Day