For uniformity, the principles regarding creating a valid attribute name are the same as those designed for generating valid element names and also for the names of some lesser known constructs.
Hey there, my name is Michael Dupre. Introducing my '5 minute XML' series in which I offer you regular byte size tutorials.
Today's topic is for those of you who are a newcomer to XML.
For uniformity, the principles regarding creating a valid attribute name are the same as those designed for generating valid element names and also for the names of some lesser known constructs.
As one I reference these as XML names. XML names could have characters while in the ranges [A-Z, a-z and 0-9]. They will often include none English letters, numbers and even ideograms.
XML names may additionally have an underscore, hyphen or full stop. A valid XML name can only commence with a letter, ideogram or even underscore. It may not start with a number hyphen or period. Element lengths are usually unrestricted.
The next few element names are all valid:
[Drivers_No]0000222[/Drivers_No]
[day-month-year]20/04/2011[/day-month-year]
[_4-bit]1010[/_4-bit]
[first-name]Peter[/first-name]
These element names are all invalid:
[Driver's_No]0000222[/Driver's_No]
[day/month/year]20/04/2011[/day/month/year]
[4-bit>1010[/4-bit]
[first name]Peter[/first name]
In the very first line, the element name carries an apostrophe. From the second line the element name includes a onward slash. In the third line the element name begins with a numeric and in the fourth, the element name contains a space. Every one of them are illegal XML names.
Precisely how namespaces work is that each element (or attribute) description is designated a prefix. Furthermore this is apart from what is called the ‘local part’ of the name, with a single colon (as written above).
It's quite common practise to relate a prefix with a URI (or Uniform Resource Indicator). The most common form is a URL (or Uniform Resource Locator).
The URI is not used for lookup using the internet. The usage is strictly to recognize a set of data objects uniquely and since URI’s are utilized across the world they are great for the job. URI’s are bound to a namespace prefix utilizing the
xmlns:prefix="URI".
This prefix along with the full URI definition are never interchangeable as URI’s may feature characters which can be illegal in an XML namespace. It's also illegal make use of the three letters XML in any event combination for a namespace prefix as these are usually reserved.
Word: XML is an abbreviation for eXtensible Mark-up Language. It's a mark-up language, as opposed to a programming language. Its objective is almost always to illustrate a class of data objects labeled an XML Document. Files is often as difficult or as elementary as is needed. A large cornucopia of information is available on XML for individuals that would like to find out more. For that definitive guide, visit www.W3.org.
I really hope the above mentioned is helpful to someone out there. Far more content is going to be on its way shortly.
| Additional articles about xml editor |
|
|
| About the author |
Michael Dupre is an skilled specialist in XML programming and even XML standards and possesses plenty of working know-how about XML Editor as well as functional know how with XML Schema. |
| Please Rate This Article |
Number of ratings: 0
Rating: 0