<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl'?>
<InformationDocument xmlns="urn:hl7-org:v3">
<realmCode code="US" />
<typeId root="3877.1.3"/>
<templateId root="44.0.1" />
<templateId root="44.0.2" />
<id root="2.2.1"/>
<code name="iii" />
<title>Title Name Here</title>
<effectiveDate value="111" />
<reminderCode code="i"/>
<languageCode code="en-US" />
<recordInfo>
<personalInfo>
<id code="11156"/>
<address>
<street>#31 Sherlon St</street>
<city>CityOne</city>
<state>D4</state>
<postalCode>1263686</postalCode>
<country>US</country>
</address>
</personalInfo>
</recordInfo>
</InformationDocument>
I have XML file above and use the code below to read it.
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("D:\\xmlFile.xml");
XmlNode node = xmlDoc.DocumentElement.FirstChild;
XmlNodeList lst = node.ChildNodes;
The lst return 0 count, and I can't continue to get the address.
for (int i = 0; i < lst.Count; i++)
{
// Look for a node named CastMembers
if (lst[i].Name == "address")
{
XmlNodeList lstSub = lst[i].ChildNodes;
for (int j = 0; j < lstSub.Count; j++)
Console.WriteLine("{0}", lstSub[j].InnerText);
}
}
Thanks in advance