Monday, March 7, 2011

Simple Type vs. Complex Type and Simple Content vs. Complex Content

Sometimes it is bit confusing to novices in the concepts Simple Type, Complex Type, Simple Content and Complext Content in XML schema. Here what I'd like to do is to highlight some key things that might be helpful in differentiate thses concepts.
  • XML schmea file defines the XML data types that may be used in the XML instance document. There are two types in schmea file: Simple Type and Complex Type.
  • Simple Type means that this type doesn't have attribute and elements except for the character data.

  • XSD has over 40 built-in Simple Types such as xsd:string, xsd:integer, xsd:boolean, xsd:date and etc and cutom-made data types of Simple Type as well.
    All custom-made Simple Type are the restriction, list of the built-in types or other custom-made simple types.

  • Contray to Simple Type, Complex Type must either have attribute or elements or both of them.

  • Simple Content and Complext Content are about how the content of a Complex Type look like. Thus they have NOTHING to do with Simple Type.

    Simple Content

3 comments:

  1. Great...I was going to crazy!!! the last phrase saved me... bye

    ReplyDelete
  2. This is exactly what I've been looking for. Thanks!

    ReplyDelete
  3. thanks a lot. crux points. best explanation so far i've been looking

    ReplyDelete