It seems that both sets of API can lead to *exactly* the same output when the DOM was converted back into XML. I was only wondering if the NS API offered any advantages in a situation where XML was being generated and not parsed or validated... especially since creating a NS element would not necessarily create the appropriate xmlns attribute. e.g. createElementNS( "DAV:", "D:prop" ) would still require that setAttributeNS( "http://www.w3.org/2000/xmlns/", "xmlns:D="DAV:") be called. And now I have the overhead of correct naming the namespace for my attribute without which the API would not work.( In my generated XML, I do not care about the default namespace for 'xmlns' attributes ). The non-NS API allow me to simplify my code, by merely adding the the appropriate attribute and not worrying about the default value being right...
Which is why I asked the questions - any benefits of using the NS methods... Regards, Keyur ----- Original Message ----- From: "David N Bertoni/Cambridge/IBM" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 21, 2002 12:10 PM Subject: Re: xerces DOM API: to NS or not to NS? > > If you want to create a document with the correct namespaces, you must use > createElementNS and createAttributeNS. Isn't that obvious from their names > and the DOM recommendation? > > Dave > > > > > "Keyur Dalal" > <[EMAIL PROTECTED] To: <[EMAIL PROTECTED]> > > cc: (bcc: David N Bertoni/Cambridge/IBM) > Subject: xerces DOM API: to NS or not to NS? > 02/21/2002 07:57 > AM > Please respond > to xerces-c-dev > > > > > > I need to create the following namespace aware XML document: > > <D:propstat xmlns:D="DAV:"> > <D:prop xmlns:R="http://foo.bar/ns"> > <D:getcontentlanguage>enUS</D:getcontentlanguage> > <R:lockedby>someuser</R:lockedby> > </D:prop> > </D:propstat> > > If I use the DOM API to generate element nodes and append > attributes, what advantages are there in using createElementNS > and createAttributeNS over createElement and createAttribute? > > Regards, > > Keyur > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]