[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Advice needed on placement of XML datatype validation methods

  • From: rbourret@d... (Ron Bourret)
  • To: xml-dev@i..., amitr@a...
  • Date: Thu, 1 Oct 1998 15:17:01 +0200

xml data type validation
Amit Rekhi wrote:
>                I am in the process of attaching datatype validation routines
> for element content in my XML file. I have come up with 2 approaches (as
> listed below)., but am not sure which is a better one.  If someone could
> give their expert opinions ....
> 
> 
> APPROACH 1
> 
> I can use NOTATIONS to identify data validation processes with element
> content. eg.
> 
> <?xml version="1.0" ?>
> <!DOCTYPE start-ele [
>    <!NOTATION Alphabet SYSTEM "AlphabetChecker.vld">
>    <!NOTATION Number SYSTEM "NumberChecker.vld">
> 
>    <!ELEMENT start-ele (#PCDATA)>
>    <!ATTLIST start-ele datatype NOTATION (Alphabet|Number) "Alphabet">
> ]>
> <start-ele datatype="Number">123</start-ele>
> 
> where AlphabetChecker.vld and NumberChecker.vld could contain  validation
> routines for checking alphabet and number datatypes.
> 
> 
> APPROACH 2
> 
> I embed my datatype validation scripts in the XSL file I attach to my XML
> data.I can embed my datatype validation scripts in HTML which will be
> outputted by my XSL file (I am using XSL to do XML -> HTML transformation)
> for elements in the XML file. In this case I could possibly use
> (JScript/VBScript/JavaScript) as languages to implement my datatype
> validation routines.
> 
> Which of the 2 approaches is better?
> 
> These 2 approaches bring out the basic questions:-
> 
>  Where to place datatype validation routines for element content, in the
> XML-DTD or in the XSL file attached to the XML data?

Of the two, I would probably use notations -- XSL is not yet finished and really 
has nothing to do with data types.  However, you should not assign the data type 
on a per-element-instance basis as your example shows.  This takes up extra 
space and is prone to errors -- element foo is a number in one case and 
alphabetic in another, which is probably not what you want.  Instead, add a dt 
attribute for each element type and assign a fixed default.  This way, the data 
type is fixed for a single element type.

Eventually, this information should go in a schema file (XSchema/DCD) and a 
validating processor (or layer) will use built-in routines to do the checking.  
If you are going to assign datatype attributes, you ought to look at/use the 
data types in DCD.

-- Ron Bourret

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.