XML comparison not showing node names

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rmnrdi
    Enthusiast
    • Dec 2017
    • 33

    XML comparison not showing node names

    I'm comparing two folders full of xml files using the sorted xml format.

    The problem is when I run the comparison (UI) or a report from a script, it doesn't give the node of the mismatched field. Only the line number.

    I attached a picture of the report output and the beyond compare window.

    I think it's because XML sort format puts the node on different lines as the value for some reason.

    Is there any way to have a sorted xml report with node values?

    Thanks,
    Rob
    Attached Files
  • Aaron
    Team Scooter
    • Oct 2007
    • 15996

    #2
    Yes, you'll want to use the option to "Show Context" (from Session menu -> Text Compare Report, Side by side layout, set to Show Differences), or in scripting use the "layout:side-by side options:display-context" to use similar options. This will include X number of context lines, which you can configure in the Options dialog, Text Editing tab, Number of context lines: X.
    Aaron P Scooter Software

    Comment

    • rmnrdi
      Enthusiast
      • Dec 2017
      • 33

      #3
      Hey Aaron,

      I need the XML report to show the node values. My boss wants the xml report because it would be easy to parse. But it has to show the nodes that we're different.

      So layout will have to be xml and options? display-context doesn't work for xml reports.

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 15996

        #4
        Hello,

        In that case, you would want to generate an XML with All (not just differences), parse to the <linecomp status="different">, and then parse around it to gather the "same" lines to find the first <node> pair.

        The Text Compare treats the files as plain text, so it does not have the syntax awareness to auto-detect where a "<node>" appears within the text; it would have to be parsed to manually.
        Aaron P Scooter Software

        Comment

        • rmnrdi
          Enthusiast
          • Dec 2017
          • 33

          #5
          If I'm just doing a text compare, how do I do an xml compare? I'm using the xml sorted file type.
          Attached Files
          Last edited by rmnrdi; 08-Jan-2018, 02:16 PM.

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 15996

            #6
            Hello,

            Sorry, BC4 does not have an XML Compare/viewer, like we do have a Text Compare, Table Compare, Picture Compare, etc. The Text Compare opens text files, which includes .xml. This line by line comparison can generate a report, output as .txt, .html, .xml, etc. The report output type is independent of the viewer type.

            The Text Compare is a line by line comparison, so the "different lines" is that specific line, and doesn't contain the surrounding equal information unless that is included (with Show Context for other report layouts, or Show All for XML layout).

            Since you need a report.xml (instead of .txt or .html) to parse down to the Different nodes, you could parse the surrounding structure for the Same lines from an All report.
            Aaron P Scooter Software

            Comment

            • rmnrdi
              Enthusiast
              • Dec 2017
              • 33

              #7
              Ok. Now will you make one of those parsers for me? Better yet, could you just add an xml parser to BC real quick? I'll wait.

              Just kidding.

              Thanks for your help.

              Comment

              • Aaron
                Team Scooter
                • Oct 2007
                • 15996

                #8
                Adding better xml comparison is something on our wishlist, but isn't a small project and not likely something we'll be able to add to BC4. But any external programs that could better format your files (such as another XML tidy.exe that places <node>data</node> on the same line) might help get the current version up and running better for you.
                Aaron P Scooter Software

                Comment

                • rmnrdi
                  Enthusiast
                  • Dec 2017
                  • 33

                  #9
                  tidy would help, but I also need the sorted feature. Child nodes may change places in parent nodes and that's ok, but if I just use tidy, will it flag child nodes that change position?

                  *Update* I tried using XML Tidied as my default format and I still don't see the node information. As a matter of fact, it's still using XML sorted and it's not even checked anymore.
                  Last edited by rmnrdi; 09-Jan-2018, 01:25 PM.

                  Comment

                  • Aaron
                    Team Scooter
                    • Oct 2007
                    • 15996

                    #10
                    Oh, sorry, I was referring more generally to any command line tidy process. We have 4 different versions for download here:
                    http://www.scootersoftware.com/downl..._moreformatsv3
                    which can import into BC4. Some include config or xslt configuration files which can alter how they function. But also if you are familiar with any command line tidy process for .xml, we could try plugging it in, if it provides a structure closer to what you need.
                    Aaron P Scooter Software

                    Comment

                    Working...