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. The Lounge
  3. XPath.

XPath.

Scheduled Pinned Locked Moved The Lounge
xmldebugging
7 Posts 4 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.
  • S Offline
    S Offline
    Septimus Hedgehog
    wrote on last edited by
    #1

    One of those eureka moments occurred to me today. I needed to trawl through a rather heavily recursive xml file. While there weren't too many element names involved, they were sufficiently recursive enough to make it really horrible to debug in a recursive method. For sure, it worked but it didn't sit comfortably with me. It was then I recalled some XPath code I prototyped a couple of years ago. I opened the project and it occurred to me that XPath could actually simplify things for me. A couple of hours later I replaced my code with far easier to read path-like syntax. It didn't eliminate the recursion but appending new element names using subscripts just really made more sense in this case and it was a breeze to identify exactly where I was in the file. I'm not advocating XPath over any other strategy to process xml files but to this humble developer, it delivered far more maintainable code. Now that I think of it, there's another method in our app which processes some of the worst xml files I've ever come across. We're talking about 300 types of element some of them with many attributes as well. XPath might just simplify that as well. To the folks who put the XPath concept together, I thank you.:thumbsup:

    If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

    B D M 4 Replies Last reply
    0
    • S Septimus Hedgehog

      One of those eureka moments occurred to me today. I needed to trawl through a rather heavily recursive xml file. While there weren't too many element names involved, they were sufficiently recursive enough to make it really horrible to debug in a recursive method. For sure, it worked but it didn't sit comfortably with me. It was then I recalled some XPath code I prototyped a couple of years ago. I opened the project and it occurred to me that XPath could actually simplify things for me. A couple of hours later I replaced my code with far easier to read path-like syntax. It didn't eliminate the recursion but appending new element names using subscripts just really made more sense in this case and it was a breeze to identify exactly where I was in the file. I'm not advocating XPath over any other strategy to process xml files but to this humble developer, it delivered far more maintainable code. Now that I think of it, there's another method in our app which processes some of the worst xml files I've ever come across. We're talking about 300 types of element some of them with many attributes as well. XPath might just simplify that as well. To the folks who put the XPath concept together, I thank you.:thumbsup:

      If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

      B Offline
      B Offline
      BillWoodruff
      wrote on last edited by
      #2

      Well, congratulations, and I look forward to reading your article on XPath here on CP ! cheers, Bill

      “But I don't want to go among mad people,” Alice remarked. “Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.” “How do you know I'm mad?” said Alice. “You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll

      S 1 Reply Last reply
      0
      • B BillWoodruff

        Well, congratulations, and I look forward to reading your article on XPath here on CP ! cheers, Bill

        “But I don't want to go among mad people,” Alice remarked. “Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.” “How do you know I'm mad?” said Alice. “You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll

        S Offline
        S Offline
        Septimus Hedgehog
        wrote on last edited by
        #3

        I'm not so sure about that Bill but thanks for the endorsement. I might put something together as a snippet for the xml-related forum. I tell you, buddy, XPath really works rather well.

        If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

        1 Reply Last reply
        0
        • S Septimus Hedgehog

          One of those eureka moments occurred to me today. I needed to trawl through a rather heavily recursive xml file. While there weren't too many element names involved, they were sufficiently recursive enough to make it really horrible to debug in a recursive method. For sure, it worked but it didn't sit comfortably with me. It was then I recalled some XPath code I prototyped a couple of years ago. I opened the project and it occurred to me that XPath could actually simplify things for me. A couple of hours later I replaced my code with far easier to read path-like syntax. It didn't eliminate the recursion but appending new element names using subscripts just really made more sense in this case and it was a breeze to identify exactly where I was in the file. I'm not advocating XPath over any other strategy to process xml files but to this humble developer, it delivered far more maintainable code. Now that I think of it, there's another method in our app which processes some of the worst xml files I've ever come across. We're talking about 300 types of element some of them with many attributes as well. XPath might just simplify that as well. To the folks who put the XPath concept together, I thank you.:thumbsup:

          If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

          B Offline
          B Offline
          BillWoodruff
          wrote on last edited by
          #4

          I look forward to reading your article on XPath, and recursive XML files, here on CP !

          “But I don't want to go among mad people,” Alice remarked. “Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.” “How do you know I'm mad?” said Alice. “You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll

          1 Reply Last reply
          0
          • S Septimus Hedgehog

            One of those eureka moments occurred to me today. I needed to trawl through a rather heavily recursive xml file. While there weren't too many element names involved, they were sufficiently recursive enough to make it really horrible to debug in a recursive method. For sure, it worked but it didn't sit comfortably with me. It was then I recalled some XPath code I prototyped a couple of years ago. I opened the project and it occurred to me that XPath could actually simplify things for me. A couple of hours later I replaced my code with far easier to read path-like syntax. It didn't eliminate the recursion but appending new element names using subscripts just really made more sense in this case and it was a breeze to identify exactly where I was in the file. I'm not advocating XPath over any other strategy to process xml files but to this humble developer, it delivered far more maintainable code. Now that I think of it, there's another method in our app which processes some of the worst xml files I've ever come across. We're talking about 300 types of element some of them with many attributes as well. XPath might just simplify that as well. To the folks who put the XPath concept together, I thank you.:thumbsup:

            If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

            D Offline
            D Offline
            dan sh
            wrote on last edited by
            #5

            Sorry but XPath is just horrible. The best way is to do a File.ReadAllText and then do all sorts to String operations.

            "Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[^]

            1 Reply Last reply
            0
            • S Septimus Hedgehog

              One of those eureka moments occurred to me today. I needed to trawl through a rather heavily recursive xml file. While there weren't too many element names involved, they were sufficiently recursive enough to make it really horrible to debug in a recursive method. For sure, it worked but it didn't sit comfortably with me. It was then I recalled some XPath code I prototyped a couple of years ago. I opened the project and it occurred to me that XPath could actually simplify things for me. A couple of hours later I replaced my code with far easier to read path-like syntax. It didn't eliminate the recursion but appending new element names using subscripts just really made more sense in this case and it was a breeze to identify exactly where I was in the file. I'm not advocating XPath over any other strategy to process xml files but to this humble developer, it delivered far more maintainable code. Now that I think of it, there's another method in our app which processes some of the worst xml files I've ever come across. We're talking about 300 types of element some of them with many attributes as well. XPath might just simplify that as well. To the folks who put the XPath concept together, I thank you.:thumbsup:

              If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

              M Offline
              M Offline
              Mark_Wallace
              wrote on last edited by
              #6

              It's short for psychopath, isn't it?

              I wanna be a eunuchs developer! Pass me a bread knife!

              S 1 Reply Last reply
              0
              • M Mark_Wallace

                It's short for psychopath, isn't it?

                I wanna be a eunuchs developer! Pass me a bread knife!

                S Offline
                S Offline
                Septimus Hedgehog
                wrote on last edited by
                #7

                It could well be.:thumbsup:

                If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

                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