RE: XML ELEMENT value required?

Subject: RE: XML ELEMENT value required?
From: "David Spreadbury" <David -dot- Spreadbury -at- afc -dot- com>
To: "TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: Fri, 2 Apr 2004 12:40:04 -0800


Ned's question was:

"... can I force an XML element's value to be required ?"

Not if the value was valid.

The way I understand XML, is if the DTD "requires" an attribute, whether it is a valid attribute or not, there better be an attribute there.

-----Original Message-----
From: David Spreadbury
Sent: Friday, April 02, 2004 2:02 PM
To: 'Mark Baker'; TECHWR-L
Subject: RE: XML ELEMENT value required?


Yes, in XML 1.0, it is specified in the DTD as #REQUIRED, which means the element must explicitly provide a value for this attribute each time it is used.

Example:

<!ATTLIST SPECIES
LatinName CDATA #REQUIRED
ReferenceType CDATA #IMPLIED
ReferenceNum CDATA #IMPLIED

The above excerpted from "Inside XML DTDs, by St. Laurent and Biggar, ISBN 0-07-134621-X.

-----Original Message-----
From: Mark Baker [mailto:listsub -at- analecta -dot- com]
Sent: Friday, April 02, 2004 2:00 PM
To: TECHWR-L
Subject: Re: XML ELEMENT value required?



Ned Bedinger asked:

> In an XML DTD, can I force an XML element's value
> to be
> required ? I want the parser to kick out an error
> if a certain element doesn't have a value.

In a DTD, no. In a schema, yes, by specifying its data type.

You can, of course, check for a value in the prcessing application that
receives the parsed data.

---
Mark Baker
Analecta Communications
www.analecta.com
+1 613 614 5881

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ROBOHELP X5 - ALL NEW VERSION!!

Have you tried the latest in Help Authoring from RoboHelp?
Try ROBOHELP X5 for Free - Now with Word 2003 support, Content
Management, Multi-Author support, PDF and XML support and much more!

Download a free trial today: http://www.ehelp.com/techwr-l4

---
You are currently subscribed to techwr-l as:
archiver -at- techwr-l -dot- com
To unsubscribe send a blank email to leave-techwr-l-obscured -at- lists -dot- raycomm -dot- com
Send administrative questions to ejray -at- raycomm -dot- com -dot- Visit
http://www.raycomm.com/techwhirl/ for more resources and info.



Follow-Ups:

Previous by Author: RE: XML ELEMENT value required?
Next by Author: RE: Autorun suggestions
Previous by Thread: Re: XML ELEMENT value required?
Next by Thread: Re: XML ELEMENT value required?


What this post helpful? Share it with friends and colleagues:


Sponsored Ads