Discussion:
How can I create an Element Node
andy lau
2010-04-26 21:31:41 UTC
Permalink
Hi,

Can you please tell me how can I create an Element Node for a
nsDocument?

http://mxr.mozilla.org/mozilla1.9.1/source/content/base/src/nsDocument.cpp#4621

After I create an Element Node, I can add tagName, add attribute key
and value to that?

Thank you.
Smaug
2010-04-26 22:53:45 UTC
Permalink
Post by andy lau
Hi,
Can you please tell me how can I create an Element Node for a
nsDocument?
http://mxr.mozilla.org/mozilla1.9.1/source/content/base/src/nsDocument.cpp#4621
After I create an Element Node, I can add tagName, add attribute key
and value to that?
Thank you.
The easiest way is probably to QI nsIDocument object to nsIDOMDocument
and call its CreateElement or CreateElementNS method.
After that you can add the attributes you need to.

(I don't know why you added the link to that line
in nsDocument.)

Btw, any reason why you don't use anything newer than 1.9.1?


-Olli

Loading...