dtd help

Kevin P. Fleming kpfleming at linuxfromscratch.org
Tue Nov 4 06:29:23 PST 2003


Jamie Bennett wrote:

> Only if the elements are required. In this case the dtd says
> 
> <!ELEMENT copy           (option*, source+, destination)>
> 
> The option* means that this is optional, the source+ means that
> this is required and the destination has no trailing symbol so 
> it can be omitted.

Are you sure about that last one Jamie? I thought that absence of any 
symbol meant that the element was required, and it would have to have 
'?' appended to make it an optional single-occurrence element. If what 
you say is true, then the DTD is incorrect because the <destination> 
element is definitely required for <copy>.

IIRC, the affixes are as follows:

(no suffix) - single occurrence, required
? - single occurrence, optional
+ - multiple occurrence, at least one required
* - multiple occurrence, none required

Also note, James, that unless otherwise specified the DTD also specifies 
the _order_ that the elements are to appear, so in this case they must 
be <option>, <source>, <destination>. It is up to the implementation 
(tool) whether it actually cares about the order (nALFS does not), but 
for the profile to pass xmllint with this DTD the order must match. This 
is the reason why there are some elements specified as (x | y)*, this 
means any number of occurrences of x or y, in any order.




More information about the alfs-discuss mailing list