|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
One attributethe xml:lang attributeis reserved for XMLs own use. This attribute is reserved to identify the human language in which the element is written. The value of the attribute is one of the ISO 639 country codes; some of the most common language codes are shown in Table 12.5.
Optionally (where several versions of the language exist, such as British and American English), the language code can be followed by a hyphen (-) and one of the ISO 3166 country codes. Some of the most common country codes are shown in Table 12.6; if you have spent much time on the Internet, you may recognize these as the same codes that are used in email addresses and URLs. An element written in American English could then be identified like this (note the cases; the language code is in lowercase and the country code is in uppercase): <para xml:lang=en-US>My country tis of thee.</para>
<para xml:lang=x-cg>Do you grok this code?</para> Naming RulesSo far you have seen examples of the markup used for elements and attributes, and in each a name has been given to the XML markup element. XML has certain specific rules governing what names you can use for all its markup objects. XMLs naming rules are as follows:
Note that spaces and tabs are not allowed in element names (<one two> would be interpreted as two separate names), and the only two punctuation signs allowed are the hyphen (-) and the period or full stop (.). No rule requires that your choice of a name should make sense. As long as you obey the naming rules, you can call XML objects whatever you like, and the names can be as long and as meaningless as you like. However, it is worth remembering that one of the major benefits of using XML in the first place is that it is self describing. If you are using elements such as <thingamajig>, <whatsit>, and <doohickey>, you will be defeating one of the major purposes of XML. Try to choose names that are suggestive of the nature or purpose of the object.
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |