Using a function how can I display xml document? RRS feed

  • Question

  • I have modified this question. I just want to display attribute values of `Message` child element of `Transaction`.

    **my code where I need to add these values.**

    **Desired output**

        <Message MessageType="GetJudicialOfficerCode" NodeID="1" ReferenceNumber="R-19293" UserID="8304" Source="IntegrationBroker">

    Here is my xml document

        <Transaction ReferenceNumber="CC-Add-Appl-Doc-06292015_05" Source="IntegrationBroker" TransactionType="Multi">

        <Message MessageType="GetCodeListing" NodeID="1" ReferenceNumber="R-19293" UserID="8304" Source="IntegrationBroker"/>


    Here is my Function

            Function GetJudgeAPI(ByVal astrJudgeId As String) As XmlDocument
            Dim objXmlOutPutDoc As XmlDocument
            Dim objXmlTransactionDoc As XmlDocument
            'Create Transaction message
            objXmlTransactionDoc = New XmlDocument
            objXmlTransactionDoc.DocumentElement.SetAttribute("ReferenceNumber", System.Guid.NewGuid.ToString)
            objXmlTransactionDoc.DocumentElement.SetAttribute("Source", "IntegrationBroker")
            objXmlTransactionDoc.DocumentElement.SetAttribute("TransactionType", "Get Judge")
     Return objXmlOutPutDoc
     End Function

    • Edited by winkimjr2 Thursday, July 16, 2015 5:07 PM I have modified my question. The only thing I need is adding or displaying the Message attributes from xml document. I need to add code to my Function but I am not sure how.
    Wednesday, July 15, 2015 9:04 PM


  • Hi winkimjr2,

    >>”The <Word ExactMatch='true'>0027R</Word> is a variable. I need to make sure the function accounts for it. How can I modify my function?”

    Based on your description, my understanding was that you want to get data from this xml document to display on somewhere. But according to your code snippet, I could only saw that you want to create an xml document.

    So I want to know what you want to do, please provide more information about your question.

    And if you want to get data from xml document to show, I have made a code sample, you could refer to the following code snippet:

    Sub ShowXMLDoc()
            Dim xmlDoc As XmlDocument = New XmlDocument()
            xmlDoc.Load(AppDomain.CurrentDomain.BaseDirectory + "XMLFile1.xml")
            Dim nodes As XmlNodeList = xmlDoc.GetElementsByTagName("Word")
            For Each item As XmlNode In nodes
                Dim value As String = item.InnerText
                MessageBox.Show("Word: " + value)
    End Sub

    The “XMLFile1.xml” was an xml document according to your posting code.

    Best Regards,

    Xavier Eoro

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, July 16, 2015 9:01 AM