I have an xml file which contains the following tag.
<ClinicalDocument xmlns:ext="http://ns.electronichealth.net.au/Ci/Cda/Extensions/3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3">
Now I have to read this and write the attribute value to a string.
Right now I am using the the follwoing code.
XmlDocument xDocument = new XmlDocument();
xDocument.Load(@"c:\Test.xml");
System.Text.StringBuilder ClinicalDocument = new System.Text.StringBuilder();
ClinicalDocument.Append("<ClinicalDocument xmlns:ext=" + xDocument.SelectSingleNode("/ClinicalDocument/@xmlns:ext").Value + " xmlns:xsi=" + xDocument.SelectSingleNode("/ClinicalDocument/@xmlns:xsi").Value + " xmlns=" + xDocument.SelectSingleNode("/ClinicalDocument/@xmlns").Value + ">");
Response.Write(ClinicalDocument);
But its throwing exception "Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function. "
Please suggest what am I doing wrong or is there any other alternative. I am completely new to XML.