Mega Code Archive

 
Categories / XML Tutorial / Introduction
 

XML documents must adhere to certain rules to be well formed

Every start-tag must have a matching  end-tag, or be a self-closing tag.  Every element must have a closing tag.  Empty tags can either use an all-in-one opening and closing tag with a slash before the final > or a separate closing tag. <?xml version="1.0" ?> <animal>     <name>T1</name>     <picture filename="tiger.jpg"/> </animal> Tags can't overlap and elements must be properly nested.  XML documents can have only one root element.  The only pieces of XML allowed outside (preceding) the root element are comments and processing instructions. <?xml version="1.0" ?> <animal>     <name>T1</name> </animal> Element names must obey XML naming conventions.  XML is case sensitive.  The namel, Name, and NAME elements are considered completely separate and unrelated. <name>T1</name> <Name>T1</Name> <NAME>T1</NAME>