>How do you create a element with a namespace without any prefix, >something like this (?):
> <Response xmlns="http://mynamespace.org"/> You're on the right track. Element responseElement = doc.createElementNS( "http://mynamespace.org", "Response" ); The question is what to do about the default namespace declaration. THEORETICALLY, it shouldn't be needed by most DOM processing, only when you write the document out to a file or SAX stream or whatever, and a good XML serializer should realize that it has to automatically create the default namespace declaration at that time. If you have a DOM that prototypes DOM Level 3, you can run namespace normalization and it will create the default namespace declaration (and reconcile any other declarations, as necessary). Or you can explicitly create it: String namespaceForNamespaces="http://www.w3.org/2000/xmlns/"; responseElement.setAttributeNS(namespaceForNamespaces,"xmlns"," http://mynamespace.org"); See also the current DOM Level 3 Working Draft, section 1.1.10 (namespaces), Document.normalizeDocument(), and appendix B.1 ("Namespace Normalization" pseudocode). ______________________________________ Joe Kesselman / IBM Research --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
