none
Easily load an XML file !

    Question

  • Hello,

    for those having problems with XML loading, try that,

    -----------------------------------

        'find one file in my-documents
        Public Shared TraktorFilePath As String = (Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\TRAKTOR\")

        Public Shared TraktorDBFilePath As String = TraktorFilePath + "Collection.nml"
        Public UnparsedXMLFile As String = Traktor_Path + "Collection_not_parsed.xml"
        Public ParsedXMLFile As String = Traktor_Path + "Collection_parsed.xml"
        Public XSLSheet As String = Traktor_Path + "reformat.xsl"

    1/ Read it
       
        Public Shared MainDataSet As DataSet = New Data.DataSet("xxxxxxx")
        Public Shared TraktorNMLReader As XmlReader = XmlReader.Create(TraktorDBFilePath)

       MainDataSet.ReadXml(TraktorNMLReader)

    2/ Save it

                'close & backup
                NMLReader.Close()
              
                'add Table to dataset, write unparsed xml
                Dim XMLExportDS As New DataSet
                XMLExportDS.Tables.Add(NewGenerated_DataTable)
                XMLExportDS.WriteXml(UnparsedXMLFile)


    3/ also, Transform it
                'parse & save (final)
                Dim xslt As New Xsl.XslCompiledTransform()
                xslt.Load(XSLSheet)
                xslt.Transform(UnparsedXMLFile, DBPath)

    (modify it to your needs)

    -----------------------
    you will have some issues with DataGridView because it's unbound.
    (I had to write extra-functions)


    hope this help !
    Saturday, February 25, 2006 11:20 PM

Answers

All replies