Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2017
    Posts
    22

    Default 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 Images Attached Images

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    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

  3. #3
    Join Date
    Dec 2017
    Posts
    22

    Default

    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.

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    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

  5. #5
    Join Date
    Dec 2017
    Posts
    22

    Default

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

  6. #6
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    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

  7. #7
    Join Date
    Dec 2017
    Posts
    22

    Default

    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.

  8. #8
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    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

  9. #9
    Join Date
    Dec 2017
    Posts
    22

    Default

    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 at 12:25 PM.

  10. #10
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •