Solved

Add node to XML Doc

Posted on 2013-06-27
4
317 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
  • 3
4 Comments
 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
Comment Utility
Hi,

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

Giannis
0
 

Author Comment

by:lrbrister
Comment Utility
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
Comment Utility
Found my own solution
0
 

Author Closing Comment

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

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now