Get the prefix associated with a namespace for XElement in CSharp
Description
The following code shows how to get the prefix associated with a namespace for XElement.
Example
/*from w ww .j ava 2s. c o m*/
using System;
using System.Linq;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass{
public static void Main(){
XElement xmlTree = XElement.Parse("<Root xmlns:aw='http://www.domain.com'/>");
string prefix = xmlTree.GetPrefixOfNamespace("http://www.domain.com");
Console.WriteLine("Prefix: {0}", prefix);
}
}