Get namespace associated with a particular prefix for XElement in CSharp
Description
The following code shows how to get namespace associated with a particular prefix for XElement.
Example
/* w w w . j ava2 s . c om*/
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'/>");
XNamespace awNamespace = xmlTree.GetNamespaceOfPrefix("aw");
Console.WriteLine("Namespace: {0}", awNamespace);
}
}