Video tutorial explains the basics of XML and some rules to be followed to write the XML elements.
Also illustrating the way the raw XML files are displayed on the modern browsers.
Its a tag based language much like HTML, the difference is we can makeup our own tags.
XML is used to structure and describe the information.
Header Information
1 | < ?xml version="1.0" encoding="utf-8"?> |
it informs about the xml version and the encoding, i.e., the standard encoding utf-8
This is optional. But still recommended by W3C
And it is automatically generated by many tools, so lets keep it! It doesn’t hurt :-)
Full code
1 2 3 4 5 | < ?xml version="1.0" encoding="utf-8"?> <xml> IBM, Oracle, Apple, Maestro, Microsoft .. <!-- Google, Yahoo! --> </xml> |
Each XML document must have only 1 root tag.
Multiple root tag gives errors.
Rules To Write Elements(Tags) Names
Can begin with underscore or letter ..followed by zero or more letters, digits, hyphens, periods and underscores.
Video Tutorial: Starting With Root Tag: Basic XML
[youtube https://www.youtube.com/watch?v=6KUzJSEixXI]
Output in the browsers
this is on Chrome
1 2 3 4 5 6 | This XML file does not appear to have any style information associated with it. The document tree is shown below. <companynames> IBM, Oracle, Apple, Maestro, Microsoft .. <!-- Google, Yahoo! --> </companynames> |