Jun
17
Written by:
Steve Gray
6/17/2010 1:04 PM
The task here is to use the SYSTEM.XML DOM and update a single node in a document. My document looks like this:
<eConnect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<POPReceivingsType>
<taUpdateCreateVendorRcd>
</taUpdateCreateVendorRcd>
<taCreateVendorAddress>
</taCreateVendorAddress>
<taPopRcptLineInsert_Items>
<taPopRcptLineInsert>
<PONUMBER>PO08/00012</PONUMBER>
<LOCNCODE>VA-PIEDMONTB</LOCNCODE>
</taPopRcptLineInsert>
<taPopRcptLineInsert>
<PONUMBER>PO08/00012</PONUMBER>
<LOCNCODE>VA-PIEDMONTA</LOCNCODE>
</taPopRcptLineInsert>
</taPopRcptLineInsert_Items>
<taPopRcptHdrInsert>
<POPRCTNM>RC08/00028</POPRCTNM>
<POPTYPE>1</POPTYPE>
<BACHNUMB>MYBATCH</BACHNUMB>
</taPopRcptHdrInsert>
</POPReceivingsType>
</eConnect>
Here is a sample of code that will do the deed.
Imports System.Xml
Dim xmlDoc As New XmlDocument
xmlDoc.Load(Application.StartupPath & "\xmlfile1.xml")
Dim xnBatch As XmlNode = xmlDoc.SelectSingleNode("eConnect/POPReceivingsType/taPopRcptHdrInsert/BACHNUMB")
xnBatch.InnerXml = "NewBatch"
MsgBox(xmlDoc.InnerXml)