Public Function CreateXMLOutput(ByRef senderEmail As String, ByRef senderName As String, _
ByRef receiverName As String, ByRef eMailList As List(Of String), ByRef addressLineOneList As List(Of String), _
ByRef addressLineTwoList As List(Of String), ByRef phoneNumberList As List(Of String), _
ByRef mobileNumberList As List(Of String), ByRef fileList As Hashtable) As String
Dim xDoc As New XmlDocument
Dim xPI As XmlProcessingInstruction
'Dim xComment As XmlComment
Dim xElmntRoot As XmlElement
Dim xElmnt As XmlElement
Dim childElmnt As XmlElement
xPI = xDoc.CreateProcessingInstruction("xml", "version='1.0'")
xDoc.AppendChild(xPI)
'xComment = xDoc.CreateComment("Family Information")
'xDoc.AppendChild(xComment)
xElmntRoot = xDoc.CreateElement("Candidate")
xDoc.AppendChild(xElmntRoot)
' Rather than creating new nodes individually,
' count on the fact that AppendChild returns a reference
' to the newly added node.
xElmnt = CType(xElmntRoot.AppendChild(xDoc.CreateElement("senderEmail")), XmlElement)
xElmnt.InnerText = senderEmail
xElmnt = xElmntRoot.AppendChild(xDoc.CreateElement("senderName"))
xElmnt.InnerText = senderName
xElmnt = xElmntRoot.AppendChild(xDoc.CreateElement("receiverName"))
xElmnt.InnerText = receiverName
xElmnt = xElmntRoot.AppendChild(xDoc.CreateElement("emailList"))
For Each emailAddress As String In eMailList
childElmnt = xElmnt.AppendChild(xDoc.CreateElement("possibleEmail"))
childElmnt.InnerText = emailAddress
Next
xElmnt = xElmntRoot.AppendChild(xDoc.CreateElement("addressLineOneList"))
For Each addressLineOne As String In addressLineOneList
childElmnt = xElmnt.AppendChild(xDoc.CreateElement("possibleAddressLineOne"))
childElmnt.InnerText = addressLineOne
Next
xElmnt = xElmntRoot.AppendChild(xDoc.CreateElement("addressLineTwoList"))
For Each addressLineTwo As String In addressLineTwoList
childElmnt = xElmnt.AppendChild(xDoc.CreateElement("possibleAddressLineTwo"))
childElmnt.InnerText = addressLineTwo
Next
xElmnt = xElmntRoot.AppendChild(xDoc.CreateElement("phoneNumberList"))
For Each phoneNumber As String In phoneNumberList
childElmnt = xElmnt.AppendChild(xDoc.CreateElement("possiblePhoneNumber"))
childElmnt.InnerText = phoneNumber
Next
xElmnt = xElmntRoot.AppendChild(xDoc.CreateElement("mobilePhoneNumberList"))
For Each mobilePhoneNumber As String In mobileNumberList
childElmnt = xElmnt.AppendChild(xDoc.CreateElement("possibleMobilePhoneNumber"))
childElmnt.InnerText = mobilePhoneNumber
Next
xElmnt = xElmntRoot.AppendChild(xDoc.CreateElement("attachmentFileList"))
Dim childChildElement As XmlElement
For Each entry As DictionaryEntry In fileList
childElmnt = xElmnt.AppendChild(xDoc.CreateElement("attachmnetFile"))
childChildElement = childElmnt.AppendChild(xDoc.CreateElement("incomingFileName"))
childChildElement.InnerText = entry.Key
childChildElement = childElmnt.AppendChild(xDoc.CreateElement("outGoingFileName"))
childChildElement.InnerText = entry.Value
Next
Return xDoc.OuterXml
End Function
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment