Re: XML read/write using schemas - Consultancy?

Robin Berjon <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
On Aug 26, 2009, at 17:34 , Michael Ludwig wrote:
> Oliver Elphick schrieb:
>> On Wed, 2009-08-26 at 00:26 +0200, Michael Ludwig wrote:
>>> use the schemas to validate input and output? Or something else?
>>
>> Is that the only point of the schema? I have found the routines that
>> validate an XML message against a schema.
>
> Yes, a schema is for typing and validation. I'm unaware of other  
> reasons
> for using a schema.

Actually a schema is a description of a language, and as such you can  
use it for bunch of things. Naturally, the basic usage is indeed  
validation, and in some cases it makes sense to use a schema for  
typing. But that does not preclude other things. For instance one  
could use a schema to generate documentation, or to provide guidance  
in an XML editor.

The usage that Oliver was thinking of is data binding, whereby one  
uses a schema to generate some form of programmatic interface to the  
data (oftentimes classes) that allows for easy mapping between objects  
that are natural in the language and XML. That being said most data  
binding approaches have limitations, and in my experience they tend to  
be useful mostly if the schema is really complex. For most simple  
cases, one can do without them.

Of course, most of the time having a schema is fairly useless to start  
with :)

-- 
Robin Berjon - http://berjon.com/



_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.