XHTML: Nine new requirements and behaviors (article - TopicsExpress



          

XHTML: Nine new requirements and behaviors (article from:builder.cnet/) In moving to XML syntax, nine issues were identified in HTML 4.0 that would no longer be acceptable in XML. Since it is best to produce only valid code in your pages, well highlight the requirements that arent immediately taken care of by the processes of validation and the use of external style sheet and script files. Element and attribute names must be in lowercase. Of all the decisions that came with XHTML 1.0, this one generated the most groans and teeth-gnashing in the developer community. The problem faced was that XML is a case-sensitive framework. is not the same as , , , or any other combination. Each of those elements would be considered different and unique. To avoid confusion between elements in XHTML, a decision on case became mandatory. Quite a few authors lobbied that using uppercase letters in elements made the HTML tags stand out in source code, therefore making them easier to locate and edit or troubleshoot. Others argued just as vehemently that uppercase letters were more difficult to type quickly when writing HTML by hand. Narrowly avoiding a coin-toss solution, the W3C chose to go with lowercase for all element and attribute names to match the HTML Document Object Model (DOM). The DOM begins all names in lowercase, switching to a method known as camel case when combining words. For instance, DOM attributes pertaining to input fields include tabIndex, where the second word is demarked with an initial capital letter. This approach results in an up-and-down style of case management, hence the label camel case. For nonempty elements, end tags are required. First, we need to define a nonempty element. Nonempty means that something, either text data or other elements, is contained between the opening and closing tags of a given element. For instance, a table is a nonempty element because it contains row and data elements. An empty element is one in HTML that never had an end tag, such as images (), line breaks (), and horizontal rules (). Quite a few of us learned to write HTML without ever closing some nonempty elements, such as paragraphs with the tag. The paragraph element and many others were explicitly defined with optional closing tags in the HTML Recommendation. SGML, the parent of HTML, allowed the optional state. However, XML has the rule requiring correct form and does not permit authors to omit end tags for any nonempty element. From here on the closing is required, as are all the other container tag closing elements. Attribute values must always be quoted. This rule is self-explanatory and actually eases the job of document authors by removing the question of whether or not an attribute had to be quoted. In HTML, single-word or numerical attributes didnt require quotes. However, lists of words, such as a meta elements keyword value or an hrefs URI value, did need them. Now authors simply quote every attribute=value to get in line with this new requirement. Attribute minimization. An attribute is minimized when only the attribute name is written, omitting a value. Some HTML references call these Boolean attributes since they have an off/on behavior (being on when the attribute is present and off when it is not). For example, the checked attribute on an input element is minimized in HTML 4.0: XML requires that every attribute have a value, so this minimized treatment is no longer allowed. To correct for this, any attribute that was minimized in HTML 4.0 is written in XHTML 1.0 with a value that mimics the attribute name. Taking our input example, an author would now write: Empty elements. Previously, we discussed the fact that nonempty elements were no longer able to have omitted ending tags. Empty elements now have a required end tag as well. Where we used to write , the full syntax becomes . Recognizing the redundancy in an otherwise empty element, XML devised a shorthand syntax, combining the opening and closing tag into a single structure. The element opens as normal, with the left-angle bracket and the element name (for instance
Posted on: Wed, 10 Sep 2014 08:10:03 +0000

Trending Topics



"stbody" style="min-height:30px;">
The Ambassador and staff of the Embassy of the Kingdom of the
The GSMA has released a new report that predicts a move away from
youtube/watch?v=YghT6Ct5cmQ&feature=share فعلا أنت أبن
As this year comes to an end I cant help but sit back and think,
I WANT TO HAVE A TATT PARTY BUT I CANT BECAUSE I HAVE TO GET READY
Rest In Peace Pashear Vang... Youll be highly missed. Youre one of
NSA collects millions of e-mail address books globally By Barton
This is the leaked audio recording of the 3 Israeli boys, recently
@anthonybourdain learning some vicious knee on neck choke and

Recently Viewed Topics




© 2015