Original Message From: "Andreas Tscharner" > Original Message From: "Suresh Chandak" >> >> 1. Do we need to have the elements in the same order in >> xml as xsd ? > > Yes, as long as you define <xs:sequence> in your XSD the elements have > to be in the same order in the XML as in your XSD. ... > If you want to add the elements in no specific order, have a look at > <xs:all> which you can use instead of <xs:sequence> in you XSD. But be > careful <xs:all> cannot be used as a replacement of <xs:sequence>, there > are some restrictions. The XSD book/page/reference (I use "XML Schema" > from O'Reilly) of your choice describes it in detail...
Just to add a bit more detail, the main limitation of xs:all is that minOccurs and maxOccurs are restricted to be either 0 or 1. Also, xs:any style wildcards are not allowed, nor can xs:all be or have anonymous compositors. And it can't be used in extension scenarios. Hence it might be a bit limiting for your needs. (BTW - some of these limitations maybe relaxed in XSD 1.1, but I wouldn't wait for that to come along!) I'd also recommend the book Andreas mentioned: http://www.amazon.com/XML-Schema-Eric-Van-Vlist/dp/0596002521/ Although, some reviewers seem to think it's not the best text to start with. HTH, Pete. -- ============================================= Pete Cordell Tech-Know-Ware Ltd for XML to C++ data binding visit http://www.tech-know-ware.com/lmx (or http://www.xml2cpp.com) ============================================= _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
