|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
XML Tips The Specific ElementFormDefault Schema Attribute
The need for a schema definition language
By: Tony Gupta
Sep. 21, 2011 07:15 AM
Here is my 'five-minute XML' series where by I give you scheduled byte size guides. Today's issue is good for those people who happen to be starting out with XML. In "XML Schema - Overview" (5 Minute XML #7), I reported the need for a schema definition language. I defined principle syntax for the purpose of indicating the namespace from the schema document and W3C URI (for referencing components and attributes not defined from the targetNamespace). In conclusion I referred to the following schema attribute: <xs:schema elementFormDefault="qualified" ...>. Here, I am hoping to explain precisely why and how this attribute is used and additionally precisely what influences it brings to bear.
Put simply an XML schema is seen as a group of rules or specification if you like, that the programmer would likely make use of to spell out the structure of an XML document. One example is with a database schema will describe the data which can be within a database (table structure, data types, etc.) An XML Schema is a lot the same for an XML document, it is effectively a rule set. A schema itself might be contains components from a variety of schemas each in its own namespace. A schema developer will have to make a decision whether or not to uncover or possibly conceal these namespaces to the instance document. The elementFormDefault schema attribute allows them to do just this. Setting elementFormDefault="unqualified" (the default) will hide (or localise) the namespaces, while setting it to "qualified" definitely will expose the namespaces outlined in the schema to the instance document. Such as the schema below describes a car which sources components through three or more other schemas. The chassis, wheels and interior are generally resulting from individual makers. Car.xsd Take note the import elements. These accept entry to elements via the diverse manufacturers. Word moreover that the schema attribute elementFormDefault will be set to unqualified. This process covers the many different manufacturers' namespaces from virtually any instance document. Such an instance record may possibly look and feel something like this: Car.xml Only the car root element namespace qualifier is subjected in the instance record, above. The various car brands providing the actual numerous components are at this point concealed or ‘localized' to the schema definition. The instance file doesn't worry itself with where the components are usually taken from. Just that they are accessible. If, on the other hand, elementFormDefault was indeed set to qualified we would probably have a different story... These will probably be introduced in another 5 Minute XML article. A large cornucopia of info is available on the subject of XML for folks who would choose to understand more. For the definitive guide, visit www.W3.org. Hopefully the above mentioned is beneficial to somebody out there. Much more information will be coming very soon. Latest Cloud Developer Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week
Breaking Cloud Computing News
|
|||||||||||||||||||||||||||||||||||||||||||||||||