Michael Glavassevich wrote: >Hi Martin, > >I assume you're referring to the DOM's behaviour when you remove an >attribute that has a default value defined in the DTD. The DOM spec says >[1] that a new attribute is added when a default value exists. There's no >user option for turning this off, though if you're eventually going to >serialize the document you can instruct an LSSerializer [2] to discard >default attributes (and content). > > Hi Michael, thank you very much for your response. You really hit the spot - that's exactly what I wanted. It seems that I must rely on some hack to get the job done. Actually, I need to get rid of this default attribute in the deserialization time. Please allow me to describe the problem. DTD does not support namespaces - that is a well known fact. The workaround used by W3C is to specify the xmlns attribute for the root element with fixed default value equal to the namespace. For some particular reason I want to modify prefixes of all elements, thus I want to create xmlns attribute for this prefix. Old xmlns attribute is no longer needed and thus should be deleted - but that cannot be done so easily. I found Xerces feature that could help me [1] but it didn't work. It looks like the best way is to modify prefixes of all elements, clone root element and replace old root element with the clone - this clone should have this attribute being removable (because of [2]). This is quite ineffective, the [1] feature would be really helpful. Is something like that feature present in Xerces? I cannot just delete the <!DOCTYPE declaration because of entities. I half-resolved this by converting this DTD to RelaxNG (hence validating using this converted RelaxNG schema), and by deleting all element/attribute rules from the DTD, using the DTD as container for entities only. This of course trashes default attributes values. What interests me is that there is certain incosistency in this behaviour. Let us suppose that DTD defines fixed xmlns attribute for the root element. If root element has null prefix then it contains this unremovable xmlns attribute. However if root element in XML has non-null prefix then this unremovable xmlns attribute is not present at all ([2]), even if namespace match. I think I'm missing something in XML specification here, but really don't know. Thank you for your interest, Sincerely, Martin Vysny
[1] http://xml.apache.org/xerces-j/features.html; the "http://apache.org/xml/features/nonvalidating/load-dtd-grammar" feature --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]