BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
Schemas, xsd, xdr
Extracting Schemas for Nested Classes
Creating Schemas from Assemblies
Strongly Typed .NET DataSet
XSD schemaLocation
Selecting Elements in Schemas
Specifying Namespaces
XSD targetNamespace
XSD Schemas
Convert XDR to XSD
Learn XSD Schemas .NET Tutorial
Conversion of genealogical files to XML with a DTD
AccessXML
Sorting by date without using a schema
Validating and enforcing a list of attribute values
Entity name support without DTDs
The Loss of Formatting When Adding a Schema
simple xml notepad
Schemas using DBMS_XMLQuery Package
Tips for Designing a DTD - Part 1 of 4
Tips for Designing a DTD- Part 2 of 4 : Semi-Structured Documents
<< reBlogger
SEO >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :269

 

General XSD Limitations

The XSD tool is mapping type definitions between the .NET type system and the XSD type system. The two systems address different computing needs, so naturally they don’t map onto each other seamlessly. The next sections will outline the differences between the two type systems and show how the XSD tool maps common XSD constructs to the .NET world.

The XSD type system is very data-centric. We find many concepts we also find in databases in the XSD type system, for example key references and uniqueness constraints. Yet, we the XSD type system also supports concepts from object-oriented programming, like complex types and inheritance. The .NET type system, on the other hand, is truly object-oriented without much regard for data-centric features. The .NET Framework provides the XML serialization attributes to provide hints directly to the XmlSerializer when we design classes for serialization to bridge some of the gaps between the two type systems. Some features of the XSD system, however, are not supported with the XmlSerializer today. Specifically, these features are:

  • Predefined array sizes with the minOccurs / maxOccurs attributes.
  • Restriction inheritance through restriction. The <enumeration> <restriction> can be expressed in the .NET type system through an enumerated value.
  • Uniqueness constraints as expressed by <unique>.
  • Referential integrity constraints expressed by <key> and <keyref>
  • The mixed content model. Minimal support for mixed content can be provided by applying the XmlTextAttribute metadata attribute to a field.
  • Separation of types and instances, multiple top-level elements can reference the same type. There is no equivalent concept in the .NET type system; two classes can not share an identity.

The XSD tool leaves it up to us to enforce the missing features. We can either modify the classes the XSD tool generates directly or develop special validator classes. In many cases we can replace the generated fields with a property and add the validation logic into the property accessors. In some cases this approach fails because validation involves multiple fields, of which some may not be deserialized yet. For example, you might deserialize an object reference before you deserialize the referenced object. In this case you cannot run any validation when you deserialize the reference. You may find that encapsulating all validation code into dedicated validation classes works better for you, because you don’t have to manipulate the generated classes.


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

An immediate job opportunity as a B
Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C

View all Jobs (Add yours)
View all CV (Add yours)



answering service
conference calling
swimming pool builder
spfxmasks
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP