Elements and Structure of XML fileXML file consist of declaration, elements, attributes , tree and comments. Before going in details about these we will learn some basic points about their uses.
XML tags are case sensitive ( Uppercase and lowercase text are treated differently)
XML elements are to be properly nested.
XML documents have one root element.
XML file has on starting and ending tag
attributes value to be enclosed within double quotes
Let us start with one sample xml file, shown here.
XML DeclarationThis is the first line in our XML file. Which reads like this.
<?xml version='1.0' standalone='yes'?>In addition to Version we can declare about encoding and standalone. Standalone should say yes or no. Yes mean the file has internal DTD ( Document Type Definition) and No mean it is linked to an external DTD.
XML ElementsElements are the main building block of an XML file. They used to store data, give idea about the data and many more. Here are some basic syntax to be followed. elements to start with letter or underscore. Numbers or other chars are not allowed at starting. No space is allowed in element name
Nested ElementsWe can keep elements within elements and they are known as nested elements.