jamie_bennett at pcpmicro.co.uk
Tue Nov 4 08:51:17 PST 2003
Long one again.
James Robertson wrote on 04 November 2003 16:28
>>>What about a "?" e.g.
>>><!ELEMENT download (file, url*, destination, digest?)>
>> '?' means that in this case digest is optional.
>So in this case '*' means that url is optional (and if used) repeatable?
That's correct. Maybe if you are using download, url should be required?
>> <details name="Jamie Bennett" age="25">
>> Overworked and Underpaid
>Aren't we all :-)
>What would the DTD of this example look like for comparison? What would
>a tokenized attribute or a list of valid choices look like?
DTD for the above would be
<!DOCTYPE person [
<!ELEMENT person (details)>
<!ELEMENT details (#PCDATA)>
name CDATA #REQUIRED
age CDATA #REQUIRED>
There are 4 different tokenized attributes :-
ID = unique id for an element.
IDREF = points to an element that has an ID attribute
ENTITY = points to an external (to the current entity) entity.
NMTOKEN = only allows letters, digits, periods, hyphens, colons
<!ELEMENT birthday (#PCDATA)>
name CDATA #REQUIRED
unique-id ID #REQUIRED
date NMTOKEN #REQUIRED>
<!ELEMENT message (#PCDATA)>
to IDREF #REQUIRED
text CDATA #REQUIRED>
So to use this we would :-
<birthday name="Jamie Bennett" unique-id="001" date="090978" />
<message to="001" text="is it time to finish work yet?" />
This associates the message element to the birthday element.
An id is unique and if I were to declare another element with a unique-id of
"001" the document becomes invalid.
A list of valid choices is just :-
<!ELEMENT priority (#PCDATA)>
level (low | normal | urgent) "normal">
The "normal" bit is the default.
>>4. Inside ATTLIST's we have CDATA and PCDATA entries. CDATA seems to be
>>able to have different stuff behind it. What does #IMPLIED, #FIXED,
>>#REQUIRED? I think I know, but an official response would be good.
>>What is PCDATA?
> These are just as they sound :-
> #IMPLIED = The attribute is optional.
>But then, what is "impied" about it? for example
> base CDATA #IMPLIED
> version CDATA #FIXED "3.1">
>base is CDATA #IMPLIED. Does this mean it picks up base from a use
>elsewhere? or this a function of how nALFS parses the profile against
>the DTD? I see here a good example of the use of #FIXED. This is
#IMPLIED means that the element is optional and the validity of the
document is not effected by its presence or lack thereof. It will be used
if it is there but it isn't required.
>OK just to make sure I am on the same page.
>'*' after an entity item (is that correct?) in an element definition
>means "optional and if used repeatable".
>'+' after and entitiy item in an element definition means "required and
>'?' after and entitiy item in an element definition means "completely
>optional, does not have to be used at all"
not quite, '?' means zero or one occurrence of the element.
>and nothing after and entitiy item in an element definition means
>"completely optional, does not have to be used at all" (this seems to
>be the same as '?')
My bad, Kevin had the correct definition as "... absence of any
symbol meant that the element was required ...".
>> Hope that helps,
>It did, thanks Jamie.
More information about the alfs-discuss