A need for a recent customer that requires data to be sent in XML form.
VB implementation code
Private FunctionCreatexml_old (ByValXMLName as String) as Boolean
Dim Srcpath as String = "C\project\srcxmlfiles\" ' generated XML stored directory
Try DimWriter as NewSystem.Xml.XmlTextWriter (Srcpath &XMLName, System.Text.Encoding.UTF8)DimNamespaceurl as String="http://www.xxx.com"' Verify that XSD needs to be used for Namespaceurlwriter. 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)DimDv asDataView =Cn.getData.DefaultView ()IfDv. Count >0 Then for eachItem asDataRowViewinchDV Writer. WriteStartElement ("FirstNode7") writer. WriteElementString ("SecondNode1", values) writer. WriteElementString ("SecondNode2", values) writer. WriteElementString ("SecondNode3", values)DimDv2 asDataView = CN.GETDATA2 (Item ("Firstnode6id")). DefaultView ()IfDv2. Count >0 Then for eachItemrmdetails asDataRowViewinchdvrmdetails Writer. WriteStartElement ("SecondNode4") writer. WriteStartElement ("ThridNode1") writer. WriteElementString ("ThridNode2", values)writer. WriteEndElement ()'Close SecondNode4Writer. WriteEndElement ()'Close ThridNode1 Next Elsewriter. WriteStartElement ("SecondNode4") writer. WriteStartElement ("ThridNode1") writer. WriteElementString ("ThridNode2","") writer. WriteEndElement ()'Close SecondNode4Writer. WriteEndElement ()'Close ThridNode1 End Ifwriter. WriteEndElement ()'Close FirstNode7 Next
Else
' Writelog FunctionEnd Ifwriter. WriteEndElement () writer. WriteEndDocument ()'Writer. Close ()'write XML to file and close writer Return True CatchEx asExceptionReturn False End Try End Function
VB generates an XML file and uses XSD validation