Problem with Xml Path
-
Hello, I'm having trouble figuring out the correct search path to find the Appointment: where CompanyKey='Mr. Key' and Date='11/11/2018 12:00:00 AM'. I've tried numerous formats in sFmt2 and can't find the magic combination. sFmt1 works to find the first occurance of 'Mr. Key'. Can someone help? Thank you - - - 11/11/2018 12:00:00 AM Add Appointment through XmlSerializer - 11/01/2018 12:00 AM Add Appointment through XmlDocument Dim sFmt1 As String = "/MyCalendar/Appointments/Appointment[@CompanyKey='Mr. Key']" Dim sFmt2 as string = "/MyCalendar/Appointments/Appointment[@CompanyKey='Mr. Key' and Date='11/11/2018 12:00 AM']" 'Dim sFmt2 as string = "/MyCalendar/Appointments/Appointment[@CompanyKey='Mr. Key'][Date='11/11/2018 12:00 AM']" Dim node As XmlNode = Me._XmlDoc.DocumentElement.SelectSingleNode(sFmt2) If IsNothing(node) = True Then Debug.WriteLine("Failed - " + sFmt) Else Debug.WriteLine("Found - " + sFmt) End If
-
Hello, I'm having trouble figuring out the correct search path to find the Appointment: where CompanyKey='Mr. Key' and Date='11/11/2018 12:00:00 AM'. I've tried numerous formats in sFmt2 and can't find the magic combination. sFmt1 works to find the first occurance of 'Mr. Key'. Can someone help? Thank you - - - 11/11/2018 12:00:00 AM Add Appointment through XmlSerializer - 11/01/2018 12:00 AM Add Appointment through XmlDocument Dim sFmt1 As String = "/MyCalendar/Appointments/Appointment[@CompanyKey='Mr. Key']" Dim sFmt2 as string = "/MyCalendar/Appointments/Appointment[@CompanyKey='Mr. Key' and Date='11/11/2018 12:00 AM']" 'Dim sFmt2 as string = "/MyCalendar/Appointments/Appointment[@CompanyKey='Mr. Key'][Date='11/11/2018 12:00 AM']" Dim node As XmlNode = Me._XmlDoc.DocumentElement.SelectSingleNode(sFmt2) If IsNothing(node) = True Then Debug.WriteLine("Failed - " + sFmt) Else Debug.WriteLine("Found - " + sFmt) End If
-
Stupid, Stupid, Stupid me. I can't believe I worked for hours on this and it turns out to be a data error. "12:00" verses "12:00:00" Thanks to a test program I found, XPath Visualizer, I found the problem immediately Sorry for my Stupidness :( :( :( Thanks