I have an xml document that looks like this:
<OUTPUT version="2.0">
<RESPONSE>
<LOAN_DATA
loan_id="xxxx"
loan_number="1111"
loan_type="HE"
status_code="OK">
<![CDATA[<MORTGAGE_LOAN xmlns="http://www.something.com/CLF" version="1.0">
<APPLICANTS>
<APPLICANT
is_declined="N"
first_name="MARISOL"
last_name="TESTCASE"
m_initial="L"
middle_name="L"
ssn="000000001" >
</APPLICANT>
</APPLICANTS>
</MORTGAGE_LOAN>]]>
</LOAN_DATA>
</RESPONSE>
</OUTPUT>
I can successfully read down to the CData section and can even access the CData section using the following:
string cData = "";
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(loanData);
XmlNode node = xDoc.DocumentElement.SelectSingleNode(@"RESPONSE/LOAN_DATA");
XmlNode childNode = node.ChildNodes[0];
if (childNode is XmlCDataSection)
{
XmlCDataSection cdataSection = childNode as XmlCDataSection;
cData = cdataSection.Value;
}
cData now holds:
<MORTGAGE_LOAN xmlns="http://www.something.com/CLF" version="1.0">
<APPLICANTS>
<APPLICANT
is_declined="N"
first_name="MARISOL"
last_name="TESTCASE"
m_initial="L"
middle_name="L"
ssn="000000001" >
</APPLICANT>
</APPLICANTS>
</MORTGAGE_LOAN>
What I want to do is to treat this as a new xml document and read it accordingly. When using the following node is always null. I've tried several versions of the xpath and it always returns null.
XmlDocument cDataDoc = new XmlDocument();
cDataDoc.LoadXml(c//node is always null here
XmlNode node =cDataDoc.DocumentElement.SelectSingleNode("MORTGAGE_LOAN/APPLICANTS/APPLICANT");
Any help would be great. Thanks ....