VB generates an xml file and uses xsd for verification. xmlxsd
A customer needs to send data in xml format.
Vb implementation code
Private Function createXML_old (ByVal xmlName As String) As Boolean
Directory for storing xml generated by Dim SrcPath As String = "c \ project \ srcXmlFiles \"'
Try Dim writer As New System. Xml. XmlTextWriter (SrcPath & xmlName, System. Text. Encoding. UTF8) Dim namespaceUrl As String =" http://www.xxx.com "'NamespaceUrl writer used to verify xsd. formatting = Formatting. indented writer. writeStartDocument () writer. writeStartElement ("root", "test", namespaceUrl) writer. writeElementString ("firstNode1", "values") writer. writeElementString ("firstNode2", "values") writer. writeElementString ("firstNode3", "values") writer. writeElementString ("firstNode4", "values) writer. writeElementString ("firstNode5", values) writer. writeElementString ("firstNode6Id", values) Dim dv As DataView = cn. getData. defaultView () If dv. count> 0 Then For Each item As DataRowView In dv writer. writeStartElement ("firstNode7") writer. writeElementString ("secondNode1", values) writer. writeElementString ("secondNode2", values) writer. writeElementString ("secondNode3", values) Dim dv2 As DataView = cn. getData2 (item ("firstNode6Id ")). defaultView () If dv2.Count> 0 Then For Each itemRMDetails As DataRowView In dvRMDetails writer. writeStartElement ("secondNode4") writer. writeStartElement ("thridNode1") writer. writeElementString ("thridNode2", values) writer. writeEndElement () 'disable secondNode4 writer. writeEndElement () 'disable thridNode1 Next Else writer. writeStartElement ("secondNode4") writer. writeStartElement ("thridNode1") writer. writeElementString ("thridNode2", "") writer. writeEndElement () 'disable secondNode4 writer. writeEndElement () 'disable thridNode1 End If writer. writeEndElement () 'disable firstNode7 Next
Else
'Writelog Function End If writer. writeEndElement () writer. writeEndDocument () 'writer. close () 'write XML into the file and Close writer Return True Catch ex As Exception Return False End Try End Function