> I found some sample code to construct an rss feed and am trying to modify it
> to match Google's specs at: http://www.google.com/base/rss_specs.html, but
> without knowing much about XML.
If you want to create an element in a namespace with the DOM in .NET
then use a namespace aware method e.g.
rssDoc.CreateElement("prefix:localname", "namespaceURI")
or e.g.
rssDoc.CreateElement("prefix", "localname", "namespaceURI")
If you want to create an attribute in a namespace with the DOM in .NET
then use a namespace aware method e.g.
elementNode.SetAttribute("localname", "namespaceURI",
"attribute value")
or e.g.
attributeNode = rssDoc.CreateAttribute("prefix:localname",
"namespaceURI");
attributeNode.Value = "attribute value";
elementNode.SetAtttributeNode(attributeNode);
You usually do not have to create xmlns attributes in the DOM as the
serializer will add them when serializing nodes properly created as
shown above. However if you want to add an xmlns attribute then make
sure you use e.g.
atttributeNode = rssDoc.CreateAttribute("xmlns:prefix",
"http://www.w3.org/2000/xmlns/");
attributeNode.Value = "namespaceURI";
as the namespace URI for the xmlns prefix is predefined as
http://www.w3.org/2000/xmlns/.

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Kal - 29 Nov 2005 21:05 GMT
Thanks, that worked fine.
Kal
>> I found some sample code to construct an rss feed and am trying to modify
>> it to match Google's specs at: http://www.google.com/base/rss_specs.html,
[quoted text clipped - 25 lines]
> as the namespace URI for the xmlns prefix is predefined as
> http://www.w3.org/2000/xmlns/.