The XML specification says this regarding multiple Attlist declarations "When more than one AttlistDecl is provided for a given element type, the contents of all those provided are merged. When more than one definition is provided for the same attribute of a given element type, the first declaration is binding and later declarations are ignored" ..is it true that this support is provided for over-riding attribute declarations using the internal subset..?? coz if its true ..how can we override the declaration , when the first one is always binding ..
Prasad Joshi<br />IBM Certified Developer - XML and Related Technologies
Here is the deal; 1) An internal subset always overrides the external subset declaration (something like the derived type choosing to have its own behaviour in OO programming) Example:- External dtd - sample.dtd <!ELEMENT aa (#PCDATA)> <!ATTLIST aa bb CDATA #FIXED "bb"> Xml file(sample.xml) with internal dtd subset overriding the external declaration for attribute bb - <!DOCTYPE aa SYSTEM "sample.dtd"[ <!ATTLIST aa bb CDATA #REQUIRED> ]> As this attribute bb is required as per the internal dtd subset, <aa /> will be an invalid element with missing attribute bb, where as <aa bb="cc"/> would be a valid element 2) If the same attribute is declared twice in the same subset(external or internal) of the dtd, the latter declaration will not be respected; Hence External dtd - sample.dtd <!ELEMENT aa (#PCDATA)> <!ATTLIST aa bb CDATA #FIXED "bb"> <!ATTLIST aa bb CDATA #REQUIRED> Xml file(sample.xml) - <!DOCTYPE aa SYSTEM "sample.dtd"[ ]> <aa/> will be a valid xml document as the #FIXED declaration will be respected; In a nutshell, the internal subset declaration( if any) will have the final say and in any given subset, the first !ATTLIST declaration for any given element will always be respected; Any one please correct me for any mistakes;
She'll be back. I'm just gonna wait here. With this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book