dtd help

Jamie Bennett jamie_bennett at pcpmicro.co.uk
Tue Nov 4 01:03:18 PST 2003


Wow, lots of questions.

James Robertson wrote on 04 November 2003 03:49
>I am by no means an XML expert.  Can someone provide a quick intro to 
>the DTD for me?  Here are my direct questions:

--------------------------------------------------------------------------
>1.  The entity 'ops' contains the elements: configure, copy, download, 
>execute, link, make, mkdir, move, ownership, package, patch, 
>permissions, remove, search_replace, stage, textdump, and unpack.  This 
>entity is used in the elements alfs and stage. Do these 'ops' elements 
>have some special level or purpose over other entities?  If so, I want 
>to denote this in the syntax doc.

Just means that alfs and stage can contain any number of the other elements,
in no particular order.
--------------------------------------------------------------------------
>2. What is the significance of a "*" in an element declaration.  e.g.
><!ELEMENT alfs           ((%ops;)*)>

'*' means an optional or repeatable occurrence %ops;
--------------------------------------------------------------------------
>What about a "?" e.g.
><!ELEMENT download       (file, url*, destination, digest?)>

'?' means that in this case digest is optional.
--------------------------------------------------------------------------
>WHat about a "+" e.g.
><!ELEMENT copy           (option*, source+, destination)>

'+' indicates a required and repeatable occurrence of, in this case, source.
--------------------------------------------------------------------------
>3. What is an ATTLIST?

An ATTLIST is a attribute list. For example, the attributes of the following
are name and age :-

	<person>
		<details name="Jamie Bennett" age="25">
			Overworked and Underpaid
		</details>
	</person>

Attributes can contain strings (CDATA), tokenized attributes, indicated by
declared tokens or enumerated attributes indicated by a choice of valid
values.
--------------------------------------------------------------------------
>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.
	#FIXED	=	Provides a constant that the attribute must contain.
If
				it doesn't then the document is invalid.
	#REQUIRED	=	The attribute must be provided.

PCDATA is processed CDATA. CDATA is just a string that the parser does not
attempt to resolve i.e. 
	
	<!ENTITY	name	"Jamie Bennett">

	<message output="Hello my name is &name;" />

is interpreted just as above if the output attribute is CDATA. If it is
PCDATA then the &name; will be resolved to Jamie Bennett.
--------------------------------------------------------------------------
>5. If a given element (a) contains in its definition other elements 
>(like copy above), does that mean when you use that element (a) you have 
>to have all the other elements in the profile?  e.g. you have to do:
><copy>
>	<option>...</option>
>	<source>...</source>
>	<destination>...</destination>
></copy>
>
>in a profile and if you don't, you'll produce an XML error?

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.

>Thanks
>James

Hope that helps,

Jamie


-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page



More information about the alfs-discuss mailing list