in Ideas Worth Sharing, Technology

Fundamentals of XHTML MP (Mobile Profile)

Since XHTML MP is based on XHTML, certain syntactical rules must be followed. Making syntactical errors is a good way to learn a programming language, but so that you don’t get frustrated with them, here are some rules you must follow with XHTML MP! Remember, HTML is very forgiving in terms of syntax, but make a small syntax error in XHTML MP and the browser may refuse to show your page!

Overall, XHTML elements consist of a start tag—element name and its attributes, element content, and closing tag. The format is like:

<element attribute="value">element content</element>

XHTML Documents Must be Well Formed

Since XHTML is based on XML, all XHTML documents must adhere to thebasic XML syntax and be well formed. The document must also have a DOCTYPE declaration.

Tags Must be Closed!

All open tags must be closed. Even if it is an empty tag like “<br>“, it must be used in the self-closed form like “<br />”. Note the extra space before the slash. It’s not mandatory, but makes things work with some older browsers. If you can validate within your editor, make it a practice to do that. Also cultivate the habit of closing a tag that you start immediately—even before you put in the content. That will ensure you don’t miss closing it later on!

Elements Must be Properly Nested

You cannot start a new paragraph until you complete the previous one. You must close tags to ensure correct nesting. Overlapping is not allowed. So the following is not valid in XHTML MP:

<p><b>Pizzas are <i>good</b>.</i></p>

It should be written as:

<p><b>Pizzas are <i>good</i>.</b></p>

Elements and Attributes Must be in Lowercase

XHTML MP is case sensitive. And you must keep all the element tags and all their attributes in lowercase, although values and content can be in any case.

Read the full article on Packt Pub

Mobile Web Development book

This is an extract from my Mobile Web Development book.

You can read the full article on Fundamentals of XHTML MP over at Packt Publisher’s website, and buy the book too from there.

The book has received great reviews

The book has already received two great reviews on Amazon.

Michael from USA gave 5 stars to the book and said Mobile Web Development is a “Great Book for converting traditional web developer to mobile world“. He further wrote:

I am doing mostly Java, PHP, RoR development. Has never done any mobile web development before. To cater my curiosity of mobile, I ordered this book using 2 day shipping. I was wondering why this book didn’t have a cent of discount. Now I know why, it is a great book which worths all the money.

I read it from beginning to end in 6 hours. I simply could not stop. It covers most important aspect of mobile web development. Now I am very anxious to try build a mobile version of my website.

Examples in the book are deep enough and very easy to understand.

I highly recommend this book

Write a Comment

Comment