Sign in to join Michael Dupre's fan club.
The Specific ElementFormDefault Schema Attribute
by Michael Dupre(1)
Howdy, my name is Anita Gupta. This is my '5 minute XML' series exactly where I will offer you scheduled byte size tutes.
Today's current subject is actually for those people that are a newcomer to XML.
Inside “XML Schema - Overview” (5 Minute XML #7), I developed the necessity of a schema definition language. I revealed the essential syntax pertaining to revealing the namespace in the schema document as well as W3C URI (for referencing components and attributes not defined within the targetNamespace).
In closing I referenced the following schema attribute: .
Right here, I'm hoping to explain why and just how this particular attribute is utilized and also just what influences it brings to bear.
To put it differently an XML schema is seen as a group of rules or specification if you'd prefer, that a coder would likely utilize to spell out the structure of an XML document.
By way of example with a database schema will explain the data which has been found in a database (table structure, data types, etc.) An XML Schema is quite a bit the same for an XML document, it's effectively a rule set.
A schema on its own might be composed of components coming from a number of schemas each in its own namespace. A schema developer would need to come to a decision whether to reveal or possibly cover these namespaces to the instance doc. The elementFormDefault schema attribute allows them to do just this.
Setting elementFormDefault="unqualified" (the default) will hide (or localise) the namespaces, in contrast to setting it to "qualified" will expose the namespaces defined throughout the schema to the instance record.
For instance the schema just below details a car which sources components through two to three other schemas. The chassis, wheels and interior are typically derived from independent manufacturers.
Car.xsd
targetNamespace="*.car.org"
xmlns="*.car.org"
xmlns:ford="*.ford.com"
xmlns:toyota="*.toyota.com"
xmlns:audi="*.audi.com"
elementFormDefault="unqualified">
schemaLocation="Ford.xsd"/>
schemaLocation="Toyota.xsd"/>
schemaLocation="Audi.xsd"/>
Be aware of the import elements. These accept entry to elements through the various manufacturers. Note in addition that typically the schema attribute elementFormDefault will be set to unqualified.
This process hides the different manufacturers’ namespaces from virtually any instance file. This sort of an instance file may well look something similar to:
Car.xml
*.car.org="" xmlns:my="
Ford F-Series F-150 Regular Cab 2WD
Pirelli P3000
leather
Purely the car root element namespace qualifier is actually exposed in the instance file, above. The several car brands providing the actual numerous components are right now hidden or ‘localised’ to the schema definition.
The instance doc doesn’t concern itself with where exactly the components are acquired from. Simply that they are available.
If, on the other hand, elementFormDefault has been set to qualified we would have a different story…
These will certainly be presented in another 5 Minute XML tutorial.
Loads of data is available concerning XML for individuals wish to know more. For the definitive guide, visit www.W3.org.
I really hope the above is useful to anybody out there. Much more content can be on its way shortly.
Anita Gupta is known as an skilled guru in XML programming as well as XML standards and has plenty of working knowledge of XML Editor and also sensible know how with XML Schema Editor.
Article submitted Monday, September 05, 2011 & read 5 times.
Leave your comments through Blogz:
No comments yet.
1-0-0-0-2-ADSO
Copyright © 2012 IcoLogic, Inc.