Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Why do we need XML Schemas other than for automatic validation? [Thread Next] Re: Why do we need XML Schemas other than for automatic validation?To: NULL Date: 7/9/2008 8:40:00 AM "Neil Smith [MVP Digital Media]" <neil@n...> wrote in message news:04o7741chg1eiclse7g53kknk6r4klh0gt@4...... > > Well, we had to do that this month as part of our unit tests when > migrating a web service from one version to a very much upgraded one. > > The schema was invaluable for providing confirmation of expectations > that response elements corresponded between versions, and catching > config settings which differed between the services (but should have > matched). > > Although it was relatively time consuming to do, it added a great > degree of confidence in the rollout procedure between the new and old > systems to generate the service responses. > > Not all the possible conditions were possible to validate (easily) > using the XSD, so additional validation using PHPUnit included MD5 > matching of nodesets, where our service responds with elements which > aren't required to be in a specific order. > > Of course, it also allows customers to validate our response if they > need to raise a maintenance ticket, so benefits all round. > > It also provided a degree of focus in discovering elements which were > deprecated in the response but still being generated - when removing > these items from the schema, the unit tests fail until the > unneccessary code is completely removed, which helped in the upgrade. > Thanks for explaining that Niel. I had never come across a good reason to use DTDs or schemas. I think I understand now. It's not that it won't work. The reason one would create them (other than for the obvious reason of validating various uncontrolled input sources) is much the same as commenting code. The main purpose is for maintenance. And schemas can do some automatic validation which comments can't. So, if I understand it correctly, If I have a XML / XSL which I can see and fully comprehend within a page or two, there is not much reason to create a schema. However, if it is a complex structure, creating a schema will not necessarily help during the initial creation (other than maybe with thinking it through), but will be helpful when changes are made in the future. While it may not catch all issues, it is another step in the process to catch as many problems as possible. It also would be useful if a new and unexpected input source is put in place. Duane | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
