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

Re: XSD spec question


xsd custom attributes
Eric van der Vlist wrote:
Hi,

On mer, 2005-04-27 at 07:33 +0300, Razvan MIHAIU wrote:
  
Eric van der Vlist wrote: 
    
On mar, 2005-04-26 at 13:22 -0700, Chris Griffin wrote:
  
      
In section 3.14.2 of http://www.w3.org/TR/xmlschema-1/ it says "{any  
attributes with non-schema namespace . . . }" Does that mean I can  
add my own attributes? For example can I do this:

  <simpleType name="myName" xyz:myattribute="something">
   . . .
  </simpleType>
    
        
Exactly!

Eric
  
      
    I was not aware of this feature before. In fact, if the above is
true, it is not possible to validate an XML Schema (which itself is an
XML document) against a DTD because there is no way to specify in a
DTD that an element can have any attributes.
    The obvious question is why would you need attributes outside the
XML Schema specification ? If you extend an XML Schema in such a way
then you defeat one of the main goals of XML, which is to be portable
(only you tool will understand the custom attributes)
    

That depends what you call portable. Your schemas are still portable in
the sense that they are still producing the same results when used by a
schema processor to validate a document. 

  
    This depends on how would you choose to use your custom attributes. Please take a look at the following example:

    <xsd:element name="Test1" type="xsd:integer" abc:SquareRoot="RealSpace"/>

    Of course, this can be much more easily expressed in XML Schema by forcing the integer to be positive.

    I am sorry, but I am unable to provide an example in which standard XML Schema cannot be used for validation but for which such an extension would do the job. I would need to search the XML-DEV archive about some constraints that can only be expressed in Schematron or RelanxNG and not in XML Schema. Anyway, I hope that you understand my point.

In other words, the core features defined in the WXS recommendations are
portable (or should be if all the implementations were conformant, but
that's another thread!).

Now, allowing foreign namespaces does insure that another of the main
goal of XML (to be eXtensible) can be achieved and that's a trade off:
  
    You have custom data types, you have inheritance !! This is what extensibility is in the first place.

    Really, the question comes down to practice: have you ever encoutered in practice a complex solution based on this kind of extension ? I mean something more complicated that the "xml:lang" attribute example provided by Ian Hunter.

-- 
Regards,
Razvan

SCJP preparation material:

http://www.mihaiu.name/2004/sun_java_scjp_310_035/index.html
http://www.mihaiu.name/2004/sun_java_scjp_310_035_test1/index.html
http://www.mihaiu.name/2004/sun_java_scjp_310_035_test2/index.html
http://www.mihaiu.name/2004/sun_java_scjp_310_035_test3/index.html
http://www.mihaiu.name/2004/sun_java_scjp_310_035_test4/index.html

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.