Solved

Add node to XML Doc

Posted on 2013-06-27
4
327 Views
Last Modified: 2013-07-03
I have the following code below
Is it possible to insert a node in the XMLDoc on the fly?
I would want to insert it right before the //Result node.

etc...
 Dim b As Boolean = sendToWebService(outputData)
etc...

 Private Function sendToWebService(ByVal text As String) As Boolean
        Try
            Dim b As Boolean = False
            Dim XmlDoc As New XmlDocument()
            Dim nameSpaceMgr As New XmlNamespaceManager(XmlDoc.NameTable)
            nameSpaceMgr.AddNamespace("csta", "http://www.ecma-international.org/standards/ecma-323/csta/ed5")
            nameSpaceMgr.AddNamespace("m5", "http://www.m5net.com/org/m5/data/v2/cti")
            XmlDoc.LoadXml(text)
              If Not (XmlDoc.SelectSingleNode("//Result") Is Nothing) Then


etc...
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 39283950
Hi,

Can you add a small sample xml for our testing purposes?

Giannis
0
 

Author Comment

by:lrbrister
ID: 39284066
It would be after the Error and ID tags below...

<org.m5.api.v1.Response xmlns:m5="http://www.m5net.com/org/m5/data/v2/cti" xmlns:csta="http://www.ecma-international.org/standards/ecma-323/csta/ed5">
    <ErrorCount>0</ErrorCount>
    <Id>1</Id>
    <Result xsi:type="org.m5.data.v2.cti.HostedConnectObject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <csta:MonitorStartResponse>
            <csta:monitorCrossRefID>1394</csta:monitorCrossRefID>
        </csta:MonitorStartResponse>
    </Result>
</org.m5.api.v1.Response>
0
 

Accepted Solution

by:
lrbrister earned 0 total points
ID: 39284648
Found my own solution
0
 

Author Closing Comment

by:lrbrister
ID: 39296000
outputData = Replace(outputData, "<Result>", "<timeStamp>" & Now().ToString("yyyy-MM-dd HH:mm:ss.fff") & "</timeStamp><Result>")
0

Featured Post

Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question