Nicky Tests Software: Learning XML Part II

Tuesday, April 16, 2013

Learning XML Part II

All XML Elements must have a Closing tag
Unlike in HTML where some elements don’t need one.
This is very important- when I update existing XML documents so that I can send a message to another systemà this is a basic thing I check so that I don’t get annoyed by a stupid error message
Oh, and if you need more incentive. It’s ILLEGAL.
XML tags are Case sensitive
Opening and Closing tags must be written with the same case
Otherwise, they are technically different.
XML Documents Must have a Root Element
In other words, all of the elements need a mummy. At least one element must be a parent to the others.
For example it should be:
<Book>
<Title>Hunger Games</Title>
</Book>
You can’t put just:
<Title>Hunger Games</Title>
(P.S. The Hunger Games Catching Fire Trailer is out now- trés excited!)

XML Attributes
Attributes provide more information about the element.
These always have to be in either single or double quotes.
Also, they only need to be in the opening tag, you don’t need to repeat the attribute in the closing tag.
Example:
<Recipe cuisine=”Italian”>
<Name> Spaghetti </Name>
</Recipe>
(Next week: Excitedly planning for a trip to Oregon)