Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have  to get the values from a XML file . I have to create a class or sth in  vb.net and than this value put into a table in database. The values in  XML file change each time so it means...each time we have a diff XML file.    Please Help . Thank you
<pre lang="xml"> <pre><title>DROGHE D'ABUSO SCREEENING</title>
                    <component>
                        <section>
                            <code code="32010" codeSystemName="Codifica Interna Laboratorio" displayName="Oppiacei">
                                <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                            </code>
                            <text>
                                <paragraph>
                                </paragraph>
                                <table>
                                    <thead>
                                        <tr>
                                            <th>Esame</th>
                                            <th>Esito</th>
                                            <th>Abnormal Flag</th>
                                            <th>Unita di misura</th>
                                            <th>Range di riferimento</th>
                                            <th>Metodo</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>Oppiacei</td>
                                            <td>Negativo</td>
                                            <td></td>
                                            <td></td>
                                            <td>ASSENTI</td>
                                           <td/>
                                        </tr>
                                    </tbody>
                                </table>
                                <footnote></footnote>
                                <paragraph>
                                </paragraph>
                                <!--Inizio Microbiologia sezione humane readable-->
                                <!--Fine   Microbiologia sezione humane readable-->
                            </text>
                            <entry typeCode="DRIV">
                                <!-- INIZIO MONO RISULTATO -->
                                <act classCode="ACT" moodCode="EVN">
                                    <code code="32010" codeSystemName="Codifica Interna Laboratorio" displayName="Oppiacei">
                                        <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                                    </code>
                                    <statusCode code="completed" />
                                    <!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <entryRelationship typeCode="COMP">
                                        <observation classCode="OBS" moodCode="EVN">
                                            <code code="32010" codeSystemName="Codifica Interna Laboratorio" displayName="Oppiacei">
                                                <!--TRASCODIFICA RISULTATI NON DISPONIBILE-->
                                                <!--ANL_COMPLETED-->
                                            </code>
                                            <statusCode code="completed" />
                                            <effectiveTime value="20170216121035" />
                                            <value xsi:type="ST">Negativo</value>
                                            <!---->
                                            <referenceRange typeCode="REFV">
                                                <observationRange classCode="OBS" moodCode="EVN.CRT">
                                                    <value xsi:type="ST">ASSENTI</value>
                                                    <interpretationCode code="N" />
                                                </observationRange>
                                            </referenceRange>
                                        </observation>
                                    </entryRelationship>
                                    <!-- VAL USED -->
                                </act>
                                <!-- FINE MONO RISULTATO -->
                            </entry>
                        </section>
                    </component>
                    <component>
                        <section>
                            <code code="32020" codeSystemName="Codifica Interna Laboratorio" displayName="Metadone">
                                <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                            </code>
                            <text>
                                <paragraph>
                                </paragraph>
                                <table>
                                    <thead>
                                        <tr>
                                            <th>Esame</th>
                                            <th>Esito</th>
                                            <th>Abnormal Flag</th>
                                            <th>Unita di misura</th>
                                            <th>Range di riferimento</th>
                                            <th>Metodo</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>Metadone</td>
                                            <td>Negativo</td>
                                            <td></td>
                                            <td></td>
                                            <td>ASSENTE</td>
                                            <td />
                                        </tr>
                                    </tbody>
                                </table>
                                <footnote></footnote>
                                <paragraph>
                                </paragraph>
                                <!--Inizio Microbiologia sezione humane readable-->
                                <!--Fine   Microbiologia sezione humane readable-->
                            </text>
                            <entry typeCode="DRIV">
                                <!-- INIZIO MONO RISULTATO -->
                                <act classCode="ACT" moodCode="EVN">
                                    <code code="32020" codeSystemName="Codifica Interna Laboratorio" displayName="Metadone">
                                        <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                                    </code>
                                    <statusCode code="completed" />
                                    <!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <entryRelationship typeCode="COMP">
                                        <observation classCode="OBS" moodCode="EVN">
                                            <code code="32020" codeSystemName="Codifica Interna Laboratorio" displayName="Metadone">
                                                <!--TRASCODIFICA RISULTATI NON DISPONIBILE-->
                                                <!--ANL_COMPLETED-->
                                            </code>
                                            <statusCode code="completed" />
                                            <effectiveTime value="20170216121035" />
                                            <value xsi:type="ST">Negativo</value>
                                            <!---->
                                            <referenceRange typeCode="REFV">
                                                <observationRange classCode="OBS" moodCode="EVN.CRT">
                                                    <value xsi:type="ST">ASSENTE</value>
                                                    <interpretationCode code="N" />
                                                </observationRange>
                                            </referenceRange>
                                        </observation>
                                    </entryRelationship>
                                    <!-- VAL USED -->
                                </act>
                                <!-- FINE MONO RISULTATO -->
                            </entry>
                        </section>
                    </component>
                    <component>
                        <section>
                            <code code="32030" codeSystemName="Codifica Interna Laboratorio" displayName="Cannabinoidi(THC)">
                                <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                            </code>
                            <text>
                                <paragraph>
                                </paragraph>
                                <table>
                                    <thead>
                                        <tr>
                                            <th>Esame</th>
                                            <th>Esito</th>
                                            <th>Abnormal Flag</th>
                                            <th>Unita di misura</th>
                                            <th>Range di riferimento</th>
                                            <th>Metodo</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>Cannabinoidi(THC)</td>
                                            <td>Negativo</td>
                                            <td></td>
                                            <td></td>
                                            <td>ASSENTE</td>
                                            <td />
                                        </tr>
                                    </tbody>
                                </table>
                                <footnote></footnote>
                                <paragraph>
                                </paragraph>
                                <!--Inizio Microbiologia sezione humane readable-->
                                <!--Fine   Microbiologia sezione humane readable-->
                            </text>
                            <entry typeCode="DRIV">
                                <!-- INIZIO MONO RISULTATO -->
                                <act classCode="ACT" moodCode="EVN">
                                    <code code="32030" codeSystemName="Codifica Interna Laboratorio" displayName="Cannabinoidi(THC)">
                                        <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                                    </code>
                                    <statusCode code="completed" />
                                    <!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <entryRelationship typeCode="COMP">
                                        <observation classCode="OBS" moodCode="EVN">
                                            <code code="32030" codeSystemName="Codifica Interna Laboratorio" displayName="Cannabinoidi(THC)">
                                                <!--TRASCODIFICA RISULTATI NON DISPONIBILE-->
                                                <!--ANL_COMPLETED-->
                                            </code>
                                            <statusCode code="completed" />
                                            <effectiveTime value="20170216121035" />
                                            <value xsi:type="ST">Negativo</value>
                                            <!---->
                                            <referenceRange typeCode="REFV">
                                                <observationRange classCode="OBS" moodCode="EVN.CRT">
                                                    <value xsi:type="ST">ASSENTE</value>
                                                    <interpretationCode code="N" />
                                                </observationRange>
                                            </referenceRange>
                                        </observation>
                                    </entryRelationship>
                                    <!-- VAL USED -->
                                </act>
                                <!-- FINE MONO RISULTATO -->
                            </entry>
                        </section>
                    </component>
                    <component>
                        <section>
                            <code code="32065" codeSystemName="Codifica Interna Laboratorio" displayName="Amfetamine/Metamfetamine/Ecstasy">
                                <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                            </code>
                            <text>
                                <paragraph>
                                </paragraph>
                                <table>
                                    <thead>
                                        <tr>
                                            <th>Esame</th>
                                            <th>Esito</th>
                                            <th>Abnormal Flag</th>
                                            <th>Unita di misura</th>
                                            <th>Range di riferimento</th>
                                            <th>Metodo</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>Amfetamine/Metamfetamine/Ecstasy</td>
                                            <td>Negativo</td>
                                            <td></td>
                                            <td></td>
                                            <td>ASSENTE</td>
                                            <td />
                                        </tr>
                                    </tbody>
                                </table>
                                <footnote></footnote>
                                <paragraph>
                                </paragraph>
                                <!--Inizio Microbiologia sezione humane readable-->
                                <!--Fine   Microbiologia sezione humane readable-->
                            </text>
                            <entry typeCode="DRIV">
                                <!-- INIZIO MONO RISULTATO -->
                                <act classCode="ACT" moodCode="EVN">
                                    <code code="32065" codeSystemName="Codifica Interna Laboratorio" displayName="Amfetamine/Metamfetamine/Ecstasy">
                                        <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                                    </code>
                                    <statusCode code="completed" />
                                    <!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <entryRelationship typeCode="COMP">
                                        <observation classCode="OBS" moodCode="EVN">
                                            <code code="32065" codeSystemName="Codifica Interna Laboratorio" displayName="Amfetamine/Metamfetamine/Ecstasy">
                                                <!--TRASCODIFICA RISULTATI NON DISPONIBILE-->
                                                <!--ANL_COMPLETED-->
                                            </code>
                                            <statusCode code="completed" />
                                            <effectiveTime value="20170216121035" />
                                            <value xsi:type="ST">Negativo</value>
                                            <!---->
                                            <referenceRange typeCode="REFV">
                                                <observationRange classCode="OBS" moodCode="EVN.CRT">
                                                    <value xsi:type="ST">ASSENTE</value>
                                                    <interpretationCode code="N" />
                                                </observationRange>
                                            </referenceRange>
                                        </observation>
                                    </entryRelationship>
                                    <!-- VAL USED -->
                                </act>
                                <!-- FINE MONO RISULTATO -->
                            </entry>
                        </section>
                    </component>
                    <component>
                        <section>
                            <code code="32050" codeSystemName="Codifica Interna Laboratorio" displayName="Cocaina">
                                <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                            </code>
                            <text>
                                <paragraph>
                                </paragraph>
                                <table>
                                    <thead>
                                        <tr>
                                            <th>Esame</th>
                                            <th>Esito</th>
                                            <th>Abnormal Flag</th>
                                            <th>Unita di misura</th>
                                            <th>Range di riferimento</th>
                                            <th>Metodo</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>Cocaina</td>
                                            <td>Negativo</td>
                                            <td></td>
                                            <td></td>
                                            <td>ASSENTE</td>
                                            <td />
                                        </tr>
                                    </tbody>
                                </table>
                                <footnote></footnote>
                                <paragraph>
                                </paragraph>
                                <!--Inizio Microbiologia sezione humane readable-->
                                <!--Fine   Microbiologia sezione humane readable-->
                            </text>
                            <entry typeCode="DRIV">
                                <!-- INIZIO MONO RISULTATO -->
                                <act classCode="ACT" moodCode="EVN">
                                    <code code="32050" codeSystemName="Codifica Interna Laboratorio" displayName="Cocaina">
                                        <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                                    </code>
                                    <statusCode code="completed" />
                                    <!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <entryRelationship typeCode="COMP">
                                        <observation classCode="OBS" moodCode="EVN">
                                            <code code="32050" codeSystemName="Codifica Interna Laboratorio" displayName="Cocaina">
                                                <!--TRASCODIFICA RISULTATI NON DISPONIBILE-->
                                                <!--ANL_COMPLETED-->
                                            </code>
                                            <statusCode code="completed" />
                                            <effectiveTime value="20170216121035" />
                                            <value xsi:type="ST">Negativo</value>
                                            <!---->
                                            <referenceRange typeCode="REFV">
                                                <observationRange classCode="OBS" moodCode="EVN.CRT">
                                                    <value xsi:type="ST">ASSENTE</value>
                                                    <interpretationCode code="N" />
                                                </observationRange>
                                            </referenceRange>
                                        </observation>
                                    </entryRelationship>
                                    <!-- VAL USED -->
                                </act>
                                <!-- FINE MONO RISULTATO -->
                            </entry>
                        </section>
                    </component>
                    <component>
                        <section>
                            <code code="35520" codeSystemName="Codifica Interna Laboratorio" displayName="Benzodiazepine">
                                <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                            </code>
                            <text>
                                <paragraph>
                                </paragraph>
                                <table>
                                    <thead>
                                        <tr>
                                            <th>Esame</th>
                                            <th>Esito</th>
                                            <th>Abnormal Flag</th>
                                            <th>Unita di misura</th>
                                            <th>Range di riferimento</th>
                                            <th>Metodo</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>Benzodiazepine</td>
                                            <td>Negativo</td>
                                            <td></td>
                                            <td></td>
                                            <td>ASSENTE</td>
                                            <td />
                                        </tr>
                                    </tbody>
                                </table>
                                <footnote></footnote>
                                <paragraph>
                                </paragraph>
                                <!--Inizio Microbiologia sezione humane readable-->
                                <!--Fine   Microbiologia sezione humane readable-->
                            </text>
                            <entry typeCode="DRIV">
                                <!-- INIZIO MONO RISULTATO -->
                                <act classCode="ACT" moodCode="EVN">
                                    <code code="35520" codeSystemName="Codifica Interna Laboratorio" displayName="Benzodiazepine">
                                        <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                                    </code>
                                    <statusCode code="completed" />
                                    <!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <entryRelationship typeCode="COMP">
                                        <observation classCode="OBS" moodCode="EVN">
                                            <code code="35520" codeSystemName="Codifica Interna Laboratorio" displayName="Benzodiazepine">
                                                <!--TRASCODIFICA RISULTATI NON DISPONIBILE-->
                                                <!--ANL_COMPLETED-->
                                            </code>
                                            <statusCode code="completed" />
                                            <effectiveTime value="20170216121035" />
                                            <value xsi:type="ST">Negativo</value>
                                            <!---->
                                            <referenceRange typeCode="REFV">
                                                <observationRange classCode="OBS" moodCode="EVN.CRT">
                                                    <value xsi:type="ST">ASSENTE</value>
                                                    <interpretationCode code="N" />
                                                </observationRange>
                                            </referenceRange>
                                        </observation>
                                    </entryRelationship>
                                    <!-- VAL USED -->
                                </act>
                                <!-- FINE MONO RISULTATO -->
                            </entry>
                        </section>
                    </component>
                    <component>
                        <section>
                            <code code="35530" codeSystemName="Codifica Interna Laboratorio" displayName="Barbiturici">
                                <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                            </code>
                            <text>
                                <paragraph>
                                </paragraph>
                                <table>
                                    <thead>
                                        <tr>
                                            <th>Esame</th>
                                            <th>Esito</th>
                                            <th>Abnormal Flag</th>
                                            <th>Unita di misura</th>
                                            <th>Range di riferimento</th>
                                            <th>Metodo</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>Barbiturici</td>
                                            <td>Negativo</td>
                                            <td></td>
                                            <td></td>
                                            <td></td>
                                            <td />
                                        </tr>
                                    </tbody>
                                </table>
                                <footnote></footnote>
                                <paragraph>
                                </paragraph>
                                <!--Inizio Microbiologia sezione humane readable-->
                                <!--Fine   Microbiologia sezione humane readable-->
                            </text>
                            <entry typeCode="DRIV">
                                <!-- INIZIO MONO RISULTATO -->
                                <act classCode="ACT" moodCode="EVN">
                                    <code code="35530" codeSystemName="Codifica Interna Laboratorio" displayName="Barbiturici">
                                        <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                                    </code>
                                    <statusCode code="completed" />
                                    <!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <entryRelationship typeCode="COMP">
                                        <observation classCode="OBS" moodCode="EVN">
                                            <code code="35530" codeSystemName="Codifica Interna Laboratorio" displayName="Barbiturici">
                                                <!--TRASCODIFICA RISULTATI NON DISPONIBILE-->
                                                <!--ANL_COMPLETED-->
                                            </code>
                                            <statusCode code="completed" />
                                            <effectiveTime value="20170216121035" />
                                            <value xsi:type="ST">Negativo</value>
                                            <!---->
                                        </observation>
                                    </entryRelationship>
                                    <!-- VAL USED -->
                                </act>
                                <!-- FINE MONO RISULTATO -->
                            </entry>
                        </section>
                    </component>
                    <component>
                        <section>
                            <code code="32080" codeSystemName="Codifica Interna Laboratorio" displayName="Buprenorfina">
                                <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                            </code>
                            <text>
                                <paragraph>
                                </paragraph>
                                <table>
                                    <thead>
                                        <tr>
                                            <th>Esame</th>
                                            <th>Esito</th>
                                            <th>Abnormal Flag</th>
                                            <th>Unita di misura</th>
                                            <th>Range di riferimento</th>
                                            <th>Metodo</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>Buprenorfina</td>
                                            <td>Negativo</td>
                                            <td></td>
                                            <td></td>
                                            <td>ASSENTE</td>
                                            <td />
                                        </tr>
                                    </tbody>
                                </table>
                                <footnote></footnote>
                                <paragraph>
                                </paragraph>
                                <!--Inizio Microbiologia sezione humane readable-->
                                <!--Fine   Microbiologia sezione humane readable-->
                            </text>
                            <entry typeCode="DRIV">
                                <!-- INIZIO MONO RISULTATO -->
                                <act classCode="ACT" moodCode="EVN">
                                    <code code="32080" codeSystemName="Codifica Interna Laboratorio" displayName="Buprenorfina">
                                        <!--TRASCODIFICA ANALISI NON DISPONIBILE-->
                                    </code>
                                    <statusCode code="completed" />
                                    <!--(INIZIO) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <!--(FINE) GESTIONE MICROBIOLOGIA MONO RISULTATO -->
                                    <entryRelationship typeCode="COMP">
                                        <observation classCode="OBS" moodCode="EVN">
                                            <code code="32080" codeSystemName="Codifica Interna Laboratorio" displayName="Buprenorfina">
                                                <!--TRASCODIFICA RISULTATI NON DISPONIBILE-->
                                                <!--ANL_COMPLETED-->
                                            </code>
                                            <statusCode code="completed" />
                                            <effectiveTime value="20170216115332" />
                                            <value xsi:type="ST">Negativo</value>
                                            <!---->
                                            <referenceRange typeCode="REFV">
                                                <observationRange classCode="OBS" moodCode="EVN.CRT">
                                                    <value xsi:type="ST">ASSENTE</value>
                                                    <interpretationCode code="N" />
                                                </observationRange>
                                            </referenceRange>
                                        </observation>
                                    </entryRelationship>
                                    <!-- VAL USED -->
                                </act>
                                <!-- FINE MONO RISULTATO -->
                            </entry>
                        </section>
                    </component>
                </section>
            </component>
            <component typeCode="COMP">
                <section classCode="DOCSECT" moodCode="EVN">
                    <!--Completo-->
                    <code code="TOS-DROGHE" displayName="TOSSICOLOGIA D'ABUSO">
                        <!-- TRASCODIFICA PER SPECIALITA' NON DISPONIBILE-->
                    </code>


What I have tried:

I don't know how to start... i start only think a logic...to crate an abstract class that get this values like parameters(but i don't how to implement)... also to create a procedure or something else that after i get the dates from XML i insert into the a table .
Posted
Updated 14-Nov-18 4:20am
v2

1 solution

Hi,

A very easy way will be ADO.NET which provides you an object called DataSet which you can use it to read an XML file and then store it into a database.

See DataSet.ReadXml to know how to read XML by dataset.

This link also talks about the same scope.

If you also would like to know how to update your databasse from datasedt you can also go to this link

To know how to work with ADO.Net in VB.Net go to the below link:
ADO.NET code examples | Microsoft Docs[^]

A very trivial example of using Oracle adapter in ADO.NET would be like this:
OracleDataAdapter da = new OracleDataAdapter();
OracleCommand cmdOra = new OracleCommand(StoredProcedureName, Connection);
cmdOra.CommandType = CommandType.StoredProcedure;

da.InsertCommand = cmdOra;
da.Update(dsDataSet);


If you want you can use ODP.NET which is also based on ADO.Net in VB to connect oracle db see the below link PLEASE:

Getting Started with Oracle Data Provider for .NET (VB.NET Version)[^]


If this did not solve your problem then please leave a comment and I will assist you by improving my solution until your problem gets solved.

Cheers,
AH
 
Share this answer
 
v6
Comments
Member 14032312 14-Nov-18 9:43am    
I am using VB.Net and i dont know how to use ado.net together with vb.net
Can you help me >
Aydin Homay 14-Nov-18 9:50am    
Hi Back, I updated the solution and added a link that shows how to use ADO.Net in VB.Net.
Member 14032312 14-Nov-18 9:48am    
Can you help me...pls write me at my email :shkelzentarja@gmail.com
Aydin Homay 14-Nov-18 9:51am    
We can keep in touch via this platform. Please do not forget to press that accept green button if it worked. ;-)
Git it a try I am sure you can do on your own.
Member 14032312 14-Nov-18 9:59am    
i don't understand it ... i am using oracle db not MY SQL ... i think it must be anodher way...if you are sure this way works than help me... i rreally need help... i am a junior developer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900