xml - Can I combine !ATTLIST features in one line of a DTD? -


i learning write xml , associated dtd's, , i'm wondering if can combine things in 1 line of !attlist.

eg:

i have element weight, , want have (kg|lb) options, set "kg" default. none of these essential, status #implied, want have default weight of "1".

can legally put in 1 line:

<!element weight (#pcdata)> <!attlist weight unit cdata "1" (kg|lb) "kg" #implied> 

or can way:

<!element weight (#pcdata)> <!attlist weight unit cdata> <!attlist weight unit "1" #implied> <!attlist weight unit (kg|lb)> <!attlist weight unit "kg" #implied> 

i suspect there problems both, , little confused how combine these features (or if can) - appreciate little guidance on doing properly.

ok, have got working doing following, although might not 'accepted practice' way:

<!element weight (#pcdata)> <!attlist weight qty  cdata "1"> <!attlist weight unit cdata (kg|lb) "kg"> 

i had break value out own attribute (which makes sense think it), , remove #implied, since read somewhere setting default value, implied anyway.

hopefully else (assuming right way it)

cheers


Comments