Click here to Skip to main content
15,886,787 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<hero_banner>
<image p3:type="simple" p3:href="tcm:86-10894" p3:title="tpw-event-large-7" xmlns:p3="http://www.w3.org/1999/xlink"></image>
<lower_text>Image 1 Caption
Posted

1 solution

Given the tags, I'm assuming that you're using LINQ to XML[^] and the System.Xml.Linq namespace.

You just need an XNamespace for the URI of the p3 namespace, which you then use to create an XName for the attribute name.

For example:
C#
var element = XElement.Parse(@"<image p3:type=""simple"" p3:href=""tcm:86-10894"" p3:title=""tpw-event-large-7"" xmlns:p3=""http://www.w3.org/1999/xlink""></image>");

XNamespace p3 = "http://www.w3.org/1999/xlink";
XName attributeName = p3 + "type";

string type = (string)element.Attribute(attributeName);
Console.WriteLine(type);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900