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.
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.
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
Check your tree for any errors, such as missing tags. Remember, all elements must have a closing tag.
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."
Software programs designed to write XML, such as Microsoft’s XML Notebook, will automatically make your declaration and check your work for proper format.