Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Simple XML & XSD Question

From: "Patrick Philippot" <patrick.philippot@--------.--.-->
To: NULL
Date: 1/4/2005 7:18:00 PM
Mark Jerde wrote:
> We have developed about 80 XML documents, each probably 150 lines
> long, that are all supposed to conform to a schema.  My understanding
> is the way to show that an XML document conforms to a schema is to
> include a reference to the XSD in the XML document, and check that it
> is valid.
>
> Some other members of the project team don't want to include a
> reference to the XSD in the XML documents, citing possible
> differences in parsers.
>
> Is my understanding of XML / XSD correct?  That is, the standard way
> to prove that a well formed XML document conforms to a schema is to
> include the reference to the XSD in the XML document.

Hi Mark,

A few remarks...

1. One thing is for sure, there will be no way for a client application 
to validate the XML document against its schema if the document doesn't 
contain any reference to the schema and if the application is not made 
aware of this schema from an external source of information.

2. Validating XML documents against their schema is not always necessary 
as long as they were produced in a safe way (e.g. they can be validated 
just after being produced). It depends on what you need to do with them 
and on how you distribute them.

3.> the standard way to prove
   > that a well formed XML document
   > conforms to a schema is to
   > include the reference to the XSD in the XML document

Adding a reference to the schema in the document will not prove 
anything. It depends on how the client application loads the XML 
document. For example, in .Net, if you don't use a validating reader, no 
validation occurs. The schema reference is just ignored. Again, you can 
provide the schema's URL to the client application, if needed, by using 
an external channel. In .Net, when using an XmlValidatingReader, the 
schema can be specified separately from the document itself (See Schemas 
property).

4. >possible differences in parsers.

If the schema is correctly defined, any reliable and correctly written 
validating parser will validate the document against that schema. 
There's no room for interpretation, the XSD specification is accurate 
enough, IMHO. If the parser fails to validate a valid document, then the 
parser is buggy. Not referencing the schema is not a protection against 
a buggy parser.

-- 
Patrick Philippot - Microsoft MVP
MainSoft Consulting Services
www.mainsoft.fr 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent