I would like to extract data from XML and convert it to a DateTime through XPaths. I have following function:
DateTime? GetXPathDate(string xPath, XDocument xDoc)
{
DateTime? result = null;
var element = xDoc.XPathSelectElement(xPath);
return result;
}
I can find the element but the issue it is wrapped in an CData:
<CarName>
<![CDATA[XXX Jan]]>
</CarName>
Is there anyway to ignore the CData part via the XDocument or do I need to regex my self out of this?