1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
Public Sub WriteXML(ByVal filename As String, ByVal VerSup As String, ByVal Tp As String, ByVal k As String)
Try
Dim Elem, ElNom, ElObj, ElInd, ElFormat, ElUnit, ElSelection, ElSelectInter, ElSeuilInter As XmlElement
Dim Typ, Types As XmlNode
Doc = New Xml.XmlDocument
Doc.Load(filename)
Dim root As XmlNode = Doc.DocumentElement
ListXml = Doc.GetElementsByTagName("type")
Dim Co As Items = CollMesure(k) ' Initialisation de la collection
If Tp = "mesures" Then
Co = CollMesure(k)
For Each Typ In ListXml
If Typ.Attributes("version").Value = VerSup Then
For Each Types In Typ
If Types.LocalName = "mesures" Then
Elem = Doc.CreateElement("item")
ElNom = Doc.CreateElement("Nom")
ElObj = Doc.CreateElement("Obj")
ElInd = Doc.CreateElement("Ind")
ElFormat = Doc.CreateElement("Format")
ElUnit = Doc.CreateElement("Unit")
ElSelection = Doc.CreateElement("Selection")
ElSelectInter = Doc.CreateElement("SelectInter")
ElSeuilInter = Doc.CreateElement("SeuilInter")
ElNom.InnerText = Co.Nom
ElObj.InnerText = Co.Obj
ElInd.InnerText = Co.Ind
ElFormat.InnerText = Co.Format
ElUnit.InnerText = Co.Unit
ElSelection.InnerText = Co.Selection
ElSelectInter.InnerText = Co.SelectInter
ElSeuilInter.InnerText = Co.SeuilInter
Elem.AppendChild(ElNom)
Elem.AppendChild(ElNom)
Elem.AppendChild(ElObj)
Elem.AppendChild(ElInd)
Elem.AppendChild(ElFormat)
Elem.AppendChild(ElUnit)
Elem.AppendChild(ElSelection)
Elem.AppendChild(ElSelectInter)
Elem.AppendChild(ElSeuilInter)
Types.InsertAfter(Elem, Types.LastChild)
End If
Next
End If
Next
End If
If Tp = "entrees" Then
Co = CollEntree(k)
For Each Typ In ListXml
If Typ.Attributes("version").Value = VerSup Then
For Each Types In Typ
If Types.LocalName = "entrees" Then
Elem = Doc.CreateElement("item")
ElNom = Doc.CreateElement("Nom")
ElObj = Doc.CreateElement("Obj")
ElInd = Doc.CreateElement("Ind")
ElFormat = Doc.CreateElement("Format")
ElUnit = Doc.CreateElement("Unit")
ElSelection = Doc.CreateElement("Selection")
ElSelectInter = Doc.CreateElement("SelectInter")
ElSeuilInter = Doc.CreateElement("SeuilInter")
ElNom.InnerText = Co.Nom
ElObj.InnerText = Co.Obj
ElInd.InnerText = Co.Ind
ElFormat.InnerText = Co.Format
ElUnit.InnerText = Co.Unit
ElSelection.InnerText = Co.Selection
ElSelectInter.InnerText = Co.SelectInter
ElSeuilInter.InnerText = Co.SeuilInter
Elem.AppendChild(ElNom)
Elem.AppendChild(ElNom)
Elem.AppendChild(ElObj)
Elem.AppendChild(ElInd)
Elem.AppendChild(ElFormat)
Elem.AppendChild(ElUnit)
Elem.AppendChild(ElSelection)
Elem.AppendChild(ElSelectInter)
Elem.AppendChild(ElSeuilInter)
Types.InsertAfter(Elem, Types.LastChild)
End If
Next
End If
Next
End If
Doc.Save(filename)
Catch ex As Exception
MsgBox("Erreur d'ecriture")
End Try
End Sub |
Partager