I am using VB .Net 2003 XML namespace to get specified values from an XML document. I have used Stylus Studio 2007 to verify that my XPath query is valid and returns the node/nodes I am looking for. However in VB .Net the below code does not return any nodes. By the end of the day I want to select a single node and get the value and insert than value into a database.
THANKS!
Rick63
//////////////////////// VB Code ////////////////////////////////////////////////
Dim xmlDoc As XmlDocument
Dim xmlNameNode As XmlNode
Dim xmlAgeNode As XmlNode
Dim FileName As String = "c:\sampleXML.xml"
xmlDoc = New XmlDocument
xmlDoc.Load(FileName)
xmlNameNode = xmlDoc.SelectSingleNode("//ClinicalDocument/recordTarget/patientRole/patient/name")
If Not xmlNameNode Is Nothing Then
Messagebox.show("WHoooooo Hoooo")
'NEVER jumps into here!
End If
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////// THE XML Document /////////////////////////////////////////////////////
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="CDA.xsl"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 file:///c:/CDA.xsd">
<!--
************************************************** ******
CDA Header
************************************************** ******
-->
<!-- TODO: Need to get report title definition-->
<title>This is a sample title</title>
<!-- TODO: effective time is the time of the submission by the patient-->
<effectiveTime value="20070318"/>
<languageCode code="en-US"/>
<recordTarget>
<patientRole>
<patient>
<name>
<!-- TODO: Patient last/first below-->
<family>First Name</family>
</name>
<administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1"/>
<birthTime value="19740322"/>
</patient>
</patientRole>
</recordTarget>
<author>
<time value="2000040714"/>
<assignedAuthor>
<assignedPerson>
<name>
<!-- TODO: Patient last/first below-->
<given>Last Name</given>
<family>First Name</family>
</name>
</assignedPerson>
</assignedAuthor>
</author>
<component>
<structuredBody>
<!--
************************************************** ******
History of Present Illness section
************************************************** ******
-->
<component>
<section>
<code code="10164-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Chief Complaint</title>
<text>
<content>
<!-- TODO: Add Chief Complaint Text Here-->
This is a sample chief complaint.
</content>
</text>
</section>
</component>
<!--
************************************************** ******
Medical Allergies
************************************************** ******
-->
<component>
<section>
<code code="10155-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Medical Allergies</title>
<text>
<list>
<!-- TODO: Add each allergy as a list item here-->
<item>Penicillin - Hives</item>
<item>Aspirin - Wheezing</item>
<item>Codeine - Itching and nausea</item>
</list>
</text>
</section>
</component>
<!--
************************************************** ******
Medications section
************************************************** ******
-->
<component>
<section>
<code code="10160-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Medications</title>
<text>
<list>
<!-- TODO: Add each medication as a list item here-->
<item>Theodur 200mg BID</item>
<item>Proventil inhaler 2puffs QID PRN</item>
</list>
</text>
</section>
</component>
<!--
************************************************** ******
Family History section
************************************************** ******
-->
<component>
<section>
<code code="10157-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Family history</title>
<text>
<list>
<!-- TODO: Add each family history row as a list item here-->
<item>Father - still living - thyroid cancer.</item>
<item>Mother - died at 67 - car accident.</item>
</list>
</text>
</section>
</component>
<!--
************************************************** ******
Problem and Surgical History section
************************************************** ******
-->
<component>
<section>
<code code="10153-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title> Problem and Surgical History</title>
<text>
<list>
<!-- TODO: add items from problem and surgery history here-->
<item>Asthma</item>
<item>High blood pressure : father</item>
<item>Heart attack</item>
</list>
</text>
</section>
</component>
<!--
************************************************** ******
Hospitalization History section
************************************************** ******
-->
<component>
<section>
<code code="11336-5" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Hospitalization History</title>
<text>
<list>
<!-- TODO: Add each hospitalization history row as a list item here-->
<item>St. Paul - Chest Pain - 2004</item>
<item>St. Paul - Broken Arm - 1999</item>
</list>
</text>
</section>
</component>
<!--
************************************************** ******
Social History section
************************************************** ******
-->
<component>
<section>
<code code="29762-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>Social History</title>
<text>
<list>
<!-- TODO: add social history items here-->
<item>Smoking :: 1 PPD, 5 years. Quit 2 years ago.</item>
<item>Alcohol :: No</item>
</list>
</text>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>