65.9K
CodeProject is changing. Read more.
Home

The prefix '' cannot be redefined from '' to 'namespaceURI' within the same start element tag.

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0 vote)

Nov 28, 2009

CPOL
viewsIcon

31162

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...

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.