XML.com: XML From the Inside Out

XML.comWebServices.XML.comO'Reilly Networkoreilly.com
  Articles | Weblogs | Newsletter | Safari Bookshelf
advertisement

Article:
 Typeless Schemas and Services
Subject: so what's the gain using anonymous types?
Date: 2004-04-03 01:00:20
From: Eric Schwarzenbach

I know what they are and what the difference is but I'm missing what your point is...what exactly (other than satisfying a philosophical objection to Xml Schema types) does using anonymous "inline" types rather than explicitly named types gain you?


You talked about using wildcards and say that idea is somehow related to this anonymous type preference idea but you never show what the connection is. Wildcards can be used in an named global complex type defition as easily as they can in an anonymous one.


Previous Message Previous Message   Next Message Next Message


Titles Only Titles Only Newest First
  • so what's the gain using anonymous types?
    2004-04-03 07:22:48 Rich Salz [Reply]

    I believe it's less complex to have one 'name' for the structure (or type, if you want to call it that), rather than two. In other words, when you see tns:Foo, you know what the XML inside is going to look like. If you add another level of indirection, by using XSD types, you can still do it but it's more complicated.


    I don't know if I'd call that just "philosophy," perhaps "engineering philosophy." :)


    • so what's the gain using anonymous types?
      2004-04-05 08:21:10 Eric Schwarzenbach [Reply]

      You (as you note) are trading off reuse. To be able to reuse a given type, you can trade the complexity of adding 1 additional name to be able to reuse it for multiple elements. This seems a pretty good trade. It seems to me you ought to have better justification for such a sweeping rule.


      Besides, the additional complexity of those type names is hidden from the standpoint of document instances.

      • so what's the gain using anonymous types?
        2004-04-05 08:36:59 Rich Salz [Reply]

        I'm not giving up reuse, I'm just saying that if you want to use, for example, XML digital signature, then you must name your element ds:Signature. It makes *your* schemas shorter, too, since you don't have to define a new element with the old type. :)


        You're guaranteed the names won't conflict, so why not just use the element name defined in the schema? It's simpler, it doesn't prevent re-use, it makes it easier for folks to "skim" your documents (I disagree with your second paragraph), and it avoids the sticky issue of XML Schema's type system, instead focusing on the document-oriented view of the XML structure.


        But that's just my opinion (and others). It's not a mandatory sweeping change; feel free to ignore me.


Sponsored By:


Contact Us | Our Mission | Privacy Policy | Advertise With Us | | Submissions Guidelines
Copyright © 2008 O'Reilly Media, Inc. | (707) 827-7000 / (800) 998-9938