The Simplest Way To Create Legitimate Names in XML
View PDF | Print View
by: michaeldupre
Total views: 12
Word Count: 498
Date: Mon, 25 Jul 2011 Time: 1:40 AM
Howdy, i'm Michael Dupre. Thank you for visiting my '5 minute XML' series through which I present you with regular byte size guides.
Today's subject matter is perfect for those of you who will be new to XML.
For consistency, the principles with regard to setting up a valid attribute name overlap with those intended for forming valid element names and also for the names of several lesser known constructs.
In unison I talk about these as XML names. XML names could have characters while in the ranges [A-Z, a-z and 0-9].
They might also include none English letters, numbers and also ideograms. XML names may additionally include an underscore, hyphen or period.
A valid XML name can only start with a letter, ideogram or even underscore. It may not begin with a number hyphen or period. Element lengths are usually infinite.
These 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]
The examples below 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]
Within the very first line, the element name contains an apostrophe. From the second line the element name incorporates a forwards slash.
In the third line the element name starts off with a number and in the fourth, the element name contains a space. Each of these are illegal XML names.
How namespaces work is that each element (or attribute) description is allocated a prefix. This really is separated from what is referred to as the ‘local part’ of the name, by the single colon (as written above).
It is not uncommon procedure to affiliate a prefix with a URI (or Uniform Resource Indicator). The most frequent form is a URL (or Uniform Resource Locator). The URI is not used for lookup via the internet.
The adoption is solely to recognize a set of data objects distinctively and since URI’s are utilized worldwide they are perfect for the job. URI’s are bound to a namespace prefix using the
xmlns:prefix="URI".
Typically the prefix as well as the full URI definition commonly are not interchangeable as URI’s can easily have characters that are illegal in an XML namespace.
It is usually illegal to make use of the three letters XML in any event combination for a namespace prefix for the reason that these usually are reserved.
Note: XML is an abbreviation for eXtensible Mark-up Language. It is a mark-up language, not really a programming language. Its main objective ought to outline for you a class of data objects titled an XML Document.
Data files is often as intricate or as easy as is needed. A large cornucopia of details are available on XML for people who would like to find out more. For your definitive guide, visit www.W3.org.
I hope the above is useful to someone reading. Additional content shall be coming shortly.
About the Author
Michael Dupre is truly an seasoned authority in XML programming and also XML standards and has loads of working know-how about XML Editor and functional know how with XML Schema Editor.