[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSD elementFormDefault="unqualified" destroys the benefits

  • From: George Cristian Bina <george@o...>
  • To: "Costello, Roger L." <costello@m...>
  • Date: Wed, 28 Jan 2009 15:51:03 +0200

Re:  XSD elementFormDefault="unqualified" destroys the benefits
Hi Roger,

The first instance imply 4 schemas (you need a different schema for each 
namespace). The second instance cannot be obtained by setting the 
elementsFromDefault to unqualified in all these 4 schemas so I believe 
all the outcome further is irrelevant having a false presumption. The 
second instance can be the result of a single schema that has 
elementFormDefault (or the form attribute on each local element) set to 
unqualified but that is a totally different thing than having 4 schemas.

Best Regards,
George
-- 
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Costello, Roger L. wrote:
> Hi Folks,
> 
> Recall that with XML Schemas you can specify that all elements in conforming instance documents must be namespace-qualified using:
> 
>     elementFormDefault="qualified"
> 
> Or, you can specify that only top-level, global elements must be namespace-qualified using:
> 
>     elementFormDefault="unqualified"
> 
> These can yield remarkably different instance documents. 
> 
> 
> INSTANCE #1
> 
> Here is an example of an instance where the schema specifies "qualified":
> 
> <?xml version="1.0"?>
> <c:camera xmlns:c="http://www.camera.org"
>           xmlns:nikon="http://www.nikon.com"
>           xmlns:olympus="http://www.olympus.com"
>           xmlns:pentax="http://www.pentax.com">
>     <c:body>
>         <nikon:description>Ergonomically designed casing for easy 
>                            handling</nikon:description>
>     </c:body>
>     <c:lens>
>         <olympus:zoom>300mm</olympus:zoom>
>         <olympus:f-stop>1.2</olympus:f-stop>
>     </c:lens>
>     <c:manual_adapter>
>         <pentax:speed>1/10,000 sec to 100 sec</pentax:speed>
>     </c:manual_adapter>
> </c:camera>
> 
> 
> INSTANCE #2
> 
> Using the same schema, but specifying "unqualified," here is the instance:
> 
> <?xml version="1.0"?>
> <c:camera xmlns:c="http://www.camera.org">
>     <body>
>         <description>Ergonomically designed 
>              casing for easy handling
>         </description>  
>     </body>
>     <lens>
>         <zoom>300mm</zoom>
>         <f-stop>1.2</f-stop>
>     </lens>
>     <manual_adapter>
>         <speed>1/10,000 sec to 100 sec</speed>
>     </manual_adapter>
> </c:camera>
> 
> 
> BENEFITS OF NAMESPACES
> 
> Namespaces modularize instance documents. They enable applications to perform module-specific processing.
> 
> 
> MODULES IN INSTANCE #1
> 
> In instance #1 the namespaces modularize the document. The document can be readily partitioned into these five modules:
> 
> -------------------------------------------
> <c:camera xmlns:c="http://www.camera.org">
>     <c:body>
>     </c:body>
>     <c:lens>
>     </c:lens>
>     <c:manual_adapter>
>     </c:manual_adapter>
> </c:camera>
> -------------------------------------------
> <nikon:description xmlns:nikon="http://www.nikon.com">
>     Ergonomically designed casing for easy handling
> </nikon:description>
> -------------------------------------------
> <olympus:zoom xmlns:olympus="http://www.olympus.com">
>     300mm
> </olympus:zoom>
> -------------------------------------------
> <olympus:f-stop xmlns:olympus="http://www.olympus.com">
>     1.2
> </olympus:f-stop>
> -------------------------------------------
> <pentax:speed xmlns:pentax="http://www.pentax.com">
>     1/10,000 sec to 100 sec
> </pentax:speed>
> -------------------------------------------
> 
> 
> MODULES IN INSTANCE #2
> 
> In instance #2 there is one namespace module and three no-namespace modules:
> 
> -------------------------------------------
> <c:camera xmlns:c="http://www.camera.org">
> </c:camera>
> -------------------------------------------
> <body>
>     <description>Ergonomically designed 
>          casing for easy handling
>     </description>  
> </body>
> -------------------------------------------
> <lens>
>     <zoom>300mm</zoom>
>     <f-stop>1.2</f-stop>
> </lens>
> -------------------------------------------
> <manual_adapter>
>     <speed>1/10,000 sec to 100 sec</speed>
> </manual_adapter>
> -------------------------------------------
> 
> 
> PROBLEMS WITH INSTANCE #2
> 
> The no-namespace modules are comprised of multiple XML vocabularies. For example, in the lens module the <lens> element comes from the camera schema, whereas the <zoom> and <f-stop> elements come from the olympus schema.
> 
> An application written for the olympus schema would not be able to process the lens module for these two reasons:
> 
> a. The elements are not associated with the olympus namespace. Consider how the olympus application would behave upon encountering the lens module: "Is that <zoom> element really the element I know about, or is it somebody else's zoom element?
> 
> b. The olympus application knows nothing about the <lens> element.
> 
> 
> RECOMMENDATION
> 
> Don't use elementFormDefault="unqualified" in your XML Schemas. It destroys the modularity benefits provided by namespaces.
> 
> 
> Do you agree with this recommendation?
> 
> /Roger
> 
> 
>  
> _______________________________________________________________________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@l...
> subscribe: xml-dev-subscribe@l...
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> 


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.