XElement.GetPrefixOfNamespace gets the prefix associated with a namespace for this XElement.
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);
}
}
Related examples in the same category