Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Problem with Xml Path

Problem with Xml Path

Scheduled Pinned Locked Moved Visual Basic
helpdebuggingxmlquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mo1492
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • M mo1492

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Do you need an @ in front of Date ?

      M 1 Reply Last reply
      0
      • L Lost User

        Do you need an @ in front of Date ?

        M Offline
        M Offline
        mo1492
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups