xmlns is special attribute. It determines namespace of current element and its children all as well. You do not have to add it to XmlDocument (XmlElement) explicitly. Use method of XmlDocument:
public virtual XmlElement CreateElement(
string prefix,
string localName,
string namespaceURI
)
Details on MSDN.
If you want you can create special method to deliver yourself from constant namespaceURI writing, something likes as following:
protected XmlElement CreateElement(string nodeName)
{
return xmlaScript.CreateElement("", nodeName, asNamespaceURI);
}
where xmlaScript
is XmlDocument object and asNamespaceURI
is namespace URI.