I've been trying to figure this out for a week without luck.
My program needs to examine two XML docs for missing contacts, when it finds a missing contact it then needs to merge the information across.
I've got the examination part working with this code:
Private Sub findAllDisplayNameMaster(ByVal ndoc As XElement)
Dim displayName = From c In ndoc...<display-name> Select c.Value
Dim cDoc = XElement.Load(contactsXML)
For Each N In displayName
addToListViewMaster(N)
contactCompare(cDoc, N)
Next
End Sub
Public Sub contactCompare(ByVal cDoc As XElement, ByVal nameC As String)
Dim displayName = From c In cDoc...<display-name> Select c.Value
For Each N In displayName
If N = nameC Then
Exit Sub
End If
Next
missingCount = missingCount + 1
End Sub
What I need to do now if pass the display-name value to a sub which gathers the entire entry block and adds to the second XML doc. I also need to make sure the category's match but think I can figure that out :)
This is the XML doc:
<?xml version="1.0" encoding="UTF-8"?>
<resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists" xmlns:cp="path:properties">
<list name="Contact List">
<entry uri="sip:038347C94B0@cpsi.invalid">
<display-name>Bb De af</display-name>
<cp:prop name="given_name" value="Bb" />
<cp:prop name="surname" value="De aaf" />
<cp:prop name="default_address" value="155.103" />
<cp:prop name="default_address_type" value="sip" />
<cp:prop name="sip_address" value="155.103" />
<cp:prop name="category" value="Work" />
<cp:prop name="entry_id" value="038347543A6AF0" />
<cp:prop name="stamp" value="5508b35bb0aeedfc32" />
<cp:prop name="data_hash" value="5508b35bbc32" />
</entry>
<entry uri="sip:7CE1410E9B39A@cpsi.invalid">
<display-name>Adith</display-name>
<cp:prop name="given_name" value="Aan" />
<cp:prop name="surname" value="th" />
<cp:prop name="default_address" value="34.155.103" />
<cp:prop name="default_address_type" value="sip" />
<cp:prop name="sip_address" value="sip:4.155.103" />
<cp:prop name="category" value="RxWorks UK" />
<cp:prop name="entry_id" value="7CE14397E54872ACE9B39A" />
<cp:prop name="stamp" value="c357f1158653488c314174458b989" />
<cp:prop name="data_hash" value="c357f1158653488c356cc058287214174458b989" />
</entry>
<cp:prop name="category" value="Work AU" />
<cp:prop name="category#2" value="Work NL" />
<cp:prop name="category#3" value="Work UK" />
<cp:prop name="category#4" value="Work US" />
</list></resource-lists>