Hello All,
I am in the process of BETTERING an XML-DTD I
made.
In the process of making it compact, I decided to encapsulate all the
repeated(in the DTD) attribute definations of elements in parameter entities,
and use para. entity refrences in places where the attr. defs. are
repeated.
But, all the repeated attributes I want to add to my parameter entity
have #FIXED and DIFFERENT values at all the places they are repeated
at, as a result of which I am not being able to add them to the para.
entity replacement text even though they are repeated.
Let me explain my problem with an
example.
I have the following 2 element declarations :-
<!ELEMENT ele1 (#PCDATA)>
<!ATTLIST ele1
common-attr CDATA #FIXED "common-attr-value1">
<!ELEMENT ele2 (#PCDATA)>
<!ATTLIST ele2
common-attr CDATA #FIXED
"common-attr-value2">
Since both the elements have AN ALMOST SIMILAR attribute
'common-att' (except the #FIXED values) I want to encapsulate the common-attr
attribute defination in a parameter entity and refrence the para. entity at
points where I want to add the common-attr defination, so that my DTD would
loook like :-
< !ENTITY %attr-def 'common-attr CDATA #FIXED
".................."
'>
|
|
\ /
What to write here
<!ELEMENT ele1 (#PCDATA)>
<!ATTLIST %attr-def; >
<!ELEMENT ele2 (#PCDATA)>
<!ATTLIST ele2 %attr-def;>
But the problem of using a parameter refrence here is that the attribute
'common-attr' has different #FIXED values at both the places it is
used so a simple refrence like %attr-def; will not give it the required #FIXED
values it requires.
Concerning this issue I have 3 questions :-
1. Whether encapsulating the attribute common-attr in a para. refrence is
proper or not even though the attribute is NOT exactly similar in both places it
is used?
(I feel it is correct,since the
attribute definations at both the places differ only in their VALUE , nothing
else!)
2. Is there way to pass #FIXED values of SAME parameter definations through
their entity refrences(something like parameter passing)? eg.
<!ELEMENT ele1 (#PCDATA)>
<!ATTLIST ele1 %attr-def(/*-------pass fixed value
here--------*/); >
<!ELEMENT ele2 (#PCDATA)>
<!ATTLIST ele2 %attr-def(/*-------pass fixed value
here--------*/);>
3. Is there any way I can add attributes like 'common-attr'(used in the eg.
above) to a para. entity and only call its refrence in places it is needed in
the DTD making sure that at each calling place a unique #FIXED value is
passed?
Thanx in advance,
AMIT REKHI
Software Engineer,
A.B.Infosys.P.Ltd,
New Delhi
INDIA.
|