DTD syntax problem

R

robbie chen

I wonder
1. If an element can contain any children ( none children is
allowed), add "*" to the element name.
2. If an element should at least contain one children, add "+" to the
element name.
3. If an element contain no children, use "EMPTY" to qualify it.

Here is an instance:

<!ELEMENT FxsChan (RULE*)>

<!ELEMENT RULESET (RULE+)>

<!ELEMENT RULE (ROUTE+)>
<!ATTLIST RULE NAME CDATA #REQUIRED>

<!ELEMENT ROUTE EMPTY>
<!ATTLIST ROUTE UID CDATA #REQUIRED>
<!ATTLIST ROUTE NAME CDATA #REQUIRED>
<!ATTLIST ROUTE PATTERN CDATA #REQUIRED>
<!ATTLIST ROUTE CHANNEL CDATA #REQUIRED>
<!ATTLIST ROUTE DEPLOY CDATA #REQUIRED>

Am I right?
 
J

JAPISoft

Yes this is correct for cardinalities.

For your DTD It doesn't seem there're errors. However, I wonder why
you have two root nodes FxsChan or RULESET ?

For the attributes write rather :

<!ATTLIST ROUTE
UID CDATA #REQUIRED
NAME CDATA #REQUIRED
PATTERN CDATA #REQUIRED
CHANNEL CDATA #REQUIRED
DEPLOY CDATA #REQUIRED>

Best regards,

A.Brillant
EditiX - XML Editor and XSLT Debugger
http://www.editix.com
 
R

robbie chen

JAPISoft said:
Yes this is correct for cardinalities.

For your DTD It doesn't seem there're errors. However, I wonder why
you have two root nodes FxsChan or RULESET ?
OK, I know. Yes, in fact FxsChan and RULESET in contained in
DialPlan in my application. Like this:
<!ELEMENT DIALPLAN (FxsChan,RULESET)>

But can I have two root nodes in XML document??
For the attributes write rather :

<!ATTLIST ROUTE
UID CDATA #REQUIRED
NAME CDATA #REQUIRED
PATTERN CDATA #REQUIRED
CHANNEL CDATA #REQUIRED
DEPLOY CDATA #REQUIRED>
The above ATTLIST is more effective and compact. I got it:)

Thanks a lot.
 
P

Peter Flynn

robbie said:
OK, I know. Yes, in fact FxsChan and RULESET in contained in
DialPlan in my application. Like this:
<!ELEMENT DIALPLAN (FxsChan,RULESET)>

But can I have two root nodes in XML document??

Not in the document: each document can only have one root element.

But any element in the DTD can be the root element, for example
this is also valid:

<?xml version="1.0"?>
<!DOCTYPE ROUTE SYSTEM "your.dtd">
<ROUTE UID="foo" NAME="bar" PATTERN="abc" CHANNEL="Beagle"
DEPLOY="now"/>

///Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top