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

Re: Suggested guidelines for using local types. (was Re: Enlightenmentvi

  • From: Francis Norton <francis@r...>
  • To: "Fuchs, Matthew" <matthew.fuchs@c...>
  • Date: Sat, 01 Sep 2001 13:03:27 +0100

reset global xslt
"Fuchs, Matthew" wrote:
> 
> In other words, if one follows the best practice of:
> 1) always using a targetNamespace for your schema
> 2) always making local names unqualified
> 3) writing your XSLT scripts as I've suggested
> then your scipts will be robust in the face of added local names or global
> names, all with the current generation of software and without needing
> access to the PSVI.
> 
But these quidelines need to make some reference to the difference
between unprefixed and unqualified elements (the big difference between
elements and attributes which is inexplicably unaddressed in the XML
Schema spec).

Say I have a SOAP wrapper round a qualified global element Q which in
turn contains an unqualified local element u

Now consider the following two messages:

message [1]:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
 <SOAP-ENV:Body>
  <m:Q xmlns:m="Some-URI">
   <U>DIS</U>
  </m:Q>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

message [2]:
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
 <Body>
  <m:Q xmlns:m="Some-URI">
   <U>DIS</U>
  </m:Q>
 </Body>
</Envelope>

Now are these equivalent messages? No, according to the namespace
recommendation (and XSLT) they're different - the inner element "U" is
in no namespace in the first case, and in the SOAP namespace in the
second case. What happens if I schema-validate the global element Q? I
trust, for the sake of consistency, that the second Q will be rejected,
even though it is textually identical to the first, and even though the
outer wrapper is identical in terms of, say, XSLT processsing.

The solution - as someone else pointed out, sorry I can't find the
posting - is to reset the default declaration on each global element
with unqualified locals, eg

  <m:Q xmlns:m="Some-URI" xmlns="">
   <U>DIS</U>
  </m:Q>

which can now be used safely in either context.

I know that namespace-aware processing tools should help prevent the
situation arising, but I really think that this issue should be
mentioned in any best practice discussion of local namespaces.

Francis.

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.