I have basic VB programming knowledge. I'm having trouble getting info from an XML file. I know I can simply open the XML as a normal file, and read it sequentially, but I'd like to have my code running as efficient as possible.
I'm reading a bunch of XML files. The <full path>+<file name>
will be passed to the xml-reading sub or function.
Here's what the XML looks like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mproxyMessage xmlns:ns2="com.cmp.mproxy.message" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:mproxyMessage">
<version>2</version>
<receiver>
<uid>az.local</uid>
</receiver>
<sender>
<uid>test.sender</uid>
</sender>
<attachments>
<attachment>
<uri>C:\Inbox\2015-09-04\2cc403ace4984782bf5ae949e22a4d5b\VJ14699062340.ima</uri>
</attachment>
</attachments>
<option>
<map>
<element>
<key>OPTION_MEXI_OPTION</key>
<value>DSUBJECT(DMA-IMA)DGIVENNAME(9803375)DSENDERID(144796) medidoc_formatrecipient : Demo User, 14699062,Department,AZO(recipient DN : uid=demo.user,null)</value>
</element>
<element>
<key>DSENDERID</key>
<value>144796</value>
</element>
<element>
<key>DGIVENNAME</key>
<value>9803375</value>
</element>
<element>
<key>OPTION_MESSAGE_UID</key>
<value>2cc403ace4984782bf5ae949e22a4d5b</value>
</element>
<element>
<key>DSUBJECT</key>
<value>DMA-IMA</value>
</element>
<element>
<key>recipientDN</key>
<value>uid=demo.user</value>
</element>
<element>
<key>recipientLabel</key>
<value>Demo User, 14699062,Department,AZO</value>
</element>
</map>
</option>
</mproxyMessage>
What I need in return (for further processing) is the value between the <uri>
tags (a file path), the DSUBJECT
value, and the recipientLabel
(only the number, but that's easy to split)
The URI seems to be quite simple using:
Dim xml = XDocument.Load(file.FullName)
MsgBox("URI: " + xml.<mproxyMessage>.<attachments>.<attachment>.<uri>.Value)
But I'm stuck with the KEY/Value part
I have been looking at several code samples to do this, but none produced the result I was hoping for...
Is their someone who can provide me a code sample?