Framework Madness!

And other adventures C# and asp.net …

XElement and XPath: Covalent Bonding

leave a comment »

Yes. It’s true. You can use XElement and XPath together.

I was working on an applet today using XElement and was having a hard time getting at nested elements. I kept searching the XElement members in VS intellisense but couldn’t get anything that even hinted at XPath like support. Well a trip to the XElement members documentation enlightened me. (http://msdn.microsoft.com/en-us/library/system.xml.linq.xelement_members.aspx) It looks like if you import the System.Xml.XPath name space you get full XPath support for returning single or multiple XElement vis-à-vis extension methods. That makes things SO much easier working with XElements. Saved a TON of time!

Advertisements

Written by Lynn Eriksen

March 7, 2009 at 2:48 am

Posted in Uncategorized

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: