TheWizardofInt
Well-known member
I have this format for an XML form:
It is a lot longer than that, and the values within it will tend to vary. It isnt well formed so I cant just import it to a dataset.
So I am stuck manually parsing this thing using XML functions - totally new ground for me.
Seems all of the examples want to tell me how to return the whole thing, as if I were blind and couldnt see it.
I need to read <Individuals-Name>Joe Light</Individuals-Name> and put that into a datatable, where Column1s Name is Name, and Column2s Name is Value, entering the name of the node I am getting (Individuals-Name) and its value (Joe Light) respectively
I have been able to read elements and tell that they have no values and what not - but does anyone have a snippet like this one:
Code:
<Individuals>
- <Individual>
<Individuals-Name>Joe Light</Individuals-Name>
<Individuals-ID-Number>3999</Individuals-ID-Number>
<Main-Applicants-Name>Joe P Light</Main-Applicants-Name>
<Main-Applicants-ID-Number>3999</Main-Applicants-ID-Number>
<Relationship-to-Main-Applicant>Self</Relationship-to-Main-Applicant>
<Birthdate>03-05-1973</Birthdate>
<Gender>Male</Gender>
<Smoker>Smoker</Smoker>
- <Application-Data>
<Rate>163.85</Rate>
<PlanCode />
<PlanNumber>MHP007</PlanNumber>
</Application-Data>
- <Dependent-Data>
<SSN- />
<depHeight />
<depWeight />
</Dependent-Data>
</Individual>
</Individuals>
It is a lot longer than that, and the values within it will tend to vary. It isnt well formed so I cant just import it to a dataset.
So I am stuck manually parsing this thing using XML functions - totally new ground for me.
Seems all of the examples want to tell me how to return the whole thing, as if I were blind and couldnt see it.
I need to read <Individuals-Name>Joe Light</Individuals-Name> and put that into a datatable, where Column1s Name is Name, and Column2s Name is Value, entering the name of the node I am getting (Individuals-Name) and its value (Joe Light) respectively
I have been able to read elements and tell that they have no values and what not - but does anyone have a snippet like this one:
Code:
Function ParseXmlContent(ByVal objXMLReader As XmlTextReader) As DataTable
read or "pull" the nodes of the XML document
Dim strNodeResult As String = ""
Dim sName As String = ""
Dim sValue As String = ""
Dim objNodeType As XmlNodeType
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add("Name")
dt.Columns.Add("Value")
read each node in turn