EDN Admin
Well-known member
In my code (vb.net) I read data from an XML -file to load a database (sql). Im using XMLtextreader.
In the XML files (more than 1000 files to do), there are at some points two same element tags. My read statement read the first element and I can get the data from the Element but my next read skips over the the second alement with same name. See
XML (in bold the two elemnts) and vb code here:
in a while loop reading the elements: first time ok.. what can i do to get the value of two or more elements from same elementnames ???<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small If<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
m_xmlr.Name = <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small "bag_LVC:gebruiksdoelVerblijfsobject"<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small Then
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small Dim<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
strgebruiksdoelVerblijfsobject <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small As<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small String<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
= m_xmlr.ReadElementContentAsString
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small do something here with data <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small then
next read and read skips second element<span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small End<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small If
XML:
<bag_LVC:Verblijfsobject><br/>
<bag_LVC:gerelateerdeAdressen><br/>
<bag_LVC:hoofdadres><br/>
<bag_LVC:identificatie>0003200000134057</bag_LVC:identificatie><br/>
</bag_LVC:hoofdadres><br/>
</bag_LVC:gerelateerdeAdressen><br/>
<bag_LVC:identificatie>0003010000125985</bag_LVC:identificatie><br/>
<bag_LVC:aanduidingRecordInactief>N</bag_LVC:aanduidingRecordInactief><br/>
<bag_LVC:aanduidingRecordCorrectie>0</bag_LVC:aanduidingRecordCorrectie><br/>
<bag_LVCfficieel>N</bag_LVCfficieel><br/>
<bag_LVC:verblijfsobjectGeometrie><br/>
<gmloint srsName="urngc:def:crs:EPSG::28992 <br/>
<gmlos>252767.348 593745.504 0.0</gmlos><br/>
</gmloint><br/>
</bag_LVC:verblijfsobjectGeometrie><br/>
<bag_LVC:gebruiksdoelVerblijfsobject>woonfunctie</bag_LVC:gebruiksdoelVerblijfsobject><br/>
<bag_LVC:gebruiksdoelVerblijfsobject>industriefunctie</bag_LVC:gebruiksdoelVerblijfsobject><br/>
<bag_LVCppervlakteVerblijfsobject>69</bag_LVCppervlakteVerblijfsobject><br/>
<bag_LVC:verblijfsobjectStatus>Verblijfsobject in gebruik</bag_LVC:verblijfsobjectStatus><br/>
<bag_LVC:tijdvakgeldigheid><br/>
<bagtype:begindatumTijdvakGeldigheid>2010072000000000</bagtype:begindatumTijdvakGeldigheid><br/>
</bag_LVC:tijdvakgeldigheid><br/>
<bag_LVC:inOnderzoek>N</bag_LVC:inOnderzoek><br/>
<bag_LVC:bron><br/>
<bagtype:documentdatum>20100720</bagtype:documentdatum><br/>
<bagtype:documentnummer>FB 2010/PANDEN001</bagtype:documentnummer><br/>
</bag_LVC:bron><br/>
<bag_LVC:gerelateerdPand><br/>
<bag_LVC:identificatie>0003100000122770</bag_LVC:identificatie><br/>
</bag_LVC:gerelateerdPand><br/>
</bag_LVC:Verblijfsobject>
View the full article
In the XML files (more than 1000 files to do), there are at some points two same element tags. My read statement read the first element and I can get the data from the Element but my next read skips over the the second alement with same name. See
XML (in bold the two elemnts) and vb code here:
in a while loop reading the elements: first time ok.. what can i do to get the value of two or more elements from same elementnames ???<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small If<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
m_xmlr.Name = <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small "bag_LVC:gebruiksdoelVerblijfsobject"<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small Then
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small Dim<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
strgebruiksdoelVerblijfsobject <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small As<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small String<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
= m_xmlr.ReadElementContentAsString
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small do something here with data <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small then
next read and read skips second element<span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small End<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small If
XML:
<bag_LVC:Verblijfsobject><br/>
<bag_LVC:gerelateerdeAdressen><br/>
<bag_LVC:hoofdadres><br/>
<bag_LVC:identificatie>0003200000134057</bag_LVC:identificatie><br/>
</bag_LVC:hoofdadres><br/>
</bag_LVC:gerelateerdeAdressen><br/>
<bag_LVC:identificatie>0003010000125985</bag_LVC:identificatie><br/>
<bag_LVC:aanduidingRecordInactief>N</bag_LVC:aanduidingRecordInactief><br/>
<bag_LVC:aanduidingRecordCorrectie>0</bag_LVC:aanduidingRecordCorrectie><br/>
<bag_LVCfficieel>N</bag_LVCfficieel><br/>
<bag_LVC:verblijfsobjectGeometrie><br/>
<gmloint srsName="urngc:def:crs:EPSG::28992 <br/>
<gmlos>252767.348 593745.504 0.0</gmlos><br/>
</gmloint><br/>
</bag_LVC:verblijfsobjectGeometrie><br/>
<bag_LVC:gebruiksdoelVerblijfsobject>woonfunctie</bag_LVC:gebruiksdoelVerblijfsobject><br/>
<bag_LVC:gebruiksdoelVerblijfsobject>industriefunctie</bag_LVC:gebruiksdoelVerblijfsobject><br/>
<bag_LVCppervlakteVerblijfsobject>69</bag_LVCppervlakteVerblijfsobject><br/>
<bag_LVC:verblijfsobjectStatus>Verblijfsobject in gebruik</bag_LVC:verblijfsobjectStatus><br/>
<bag_LVC:tijdvakgeldigheid><br/>
<bagtype:begindatumTijdvakGeldigheid>2010072000000000</bagtype:begindatumTijdvakGeldigheid><br/>
</bag_LVC:tijdvakgeldigheid><br/>
<bag_LVC:inOnderzoek>N</bag_LVC:inOnderzoek><br/>
<bag_LVC:bron><br/>
<bagtype:documentdatum>20100720</bagtype:documentdatum><br/>
<bagtype:documentnummer>FB 2010/PANDEN001</bagtype:documentnummer><br/>
</bag_LVC:bron><br/>
<bag_LVC:gerelateerdPand><br/>
<bag_LVC:identificatie>0003100000122770</bag_LVC:identificatie><br/>
</bag_LVC:gerelateerdPand><br/>
</bag_LVC:Verblijfsobject>
View the full article