Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the advantages and disadvantages of using XML schemas?

Tags:

xml

xsd

We are utilizing the XML data type in Microsoft SQL Server 2005 for a project. Some members of the team and I feel that we should also use XSDs while members of the other camp feel that we should keep the XMLs ad hoc and not treat them as "types".

The XMLs are an effort to bring structure and centrality to a number of text configuration files that are a maintenance nightmare.

We are using .NET 3.5/C# and our tables are designed with the appropriate data types. My argument is that we are already "types oriented" in our thinking why break that approach because it is XML. It is because of the lack of types with the text files that the original problem occured. Not using a "types" approach leaves us open to the same problem.

May be my understanding of the benefits of XML schemas are incorrect. So what are the advantages and disadvantages of using XML schemas?

like image 808
Brian Singh Avatar asked Sep 26 '08 15:09

Brian Singh


People also ask

What are the advantages and disadvantages of XML schema?

1. XML syntax is verbose and redundant compared to other text-based data transmission formats such as JSON. 2. The redundancy in syntax of XML causes higher storage and transportation cost when the volume of data is large.

What is XML explain the features and advantages of XML in detail?

XML stores data in plain text format. This provides a software- and hardware-independent way of storing, transporting, and sharing data. XML also makes it easier to expand or upgrade to new operating systems, new applications, or new browsers, without losing data.


1 Answers

Unfortunately even the authoring body of XSD (W3C) understands that XSD is a pretty bad technology. That said, it's intention isn't necessarily bad. One of C#'s major benefits is that it is statically typed. Statically typing your XML documents gives them the same benefits. What's probably best here is reverse engineering your classes to produce the Schema using the XML serialization attributes. When you do this C# will create a custom data reader for your XML file which will dramatically improve performance.

One of the biggest costs of XML is that it has to be string parsed. The more assumptions you can make about your XML files (e.g. their structure), the better your performance is likely to be.

So ultimately like many things, is their enough of a need for performance benefits to justify the costs in developer time. Or is there a strong enough desire to use statically typed systems to justify the cost of writing the XSD.

Ultimately your project needs will dictate what you should do, but static-typing and performance are major benefits to consider.

like image 176
Orion Adrian Avatar answered Oct 09 '22 11:10

Orion Adrian