XML nodes on the same line

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

    XML nodes on the same line

    Is there anyway to display xml nodes on the same line of a report?

    BTW I use scripting.

    I attached an image with a simple comparison of two xml files.

    Why is the xml nodes on different lines?

    They're not in the document like that.

    Is there any way to generate a report that has lines that look like this?
    <node> node value </node>

    I attached a picture of the html report that's generated from an xml. There's one key thing missing...the names of the nodes. The report just shows the difference not what the node is.


    Thanks,
    Rob
    Attached Files
    Last edited by rmnrdi; 21-Nov-2018, 01:15 PM.
  • Aaron
    Team Scooter
    • Oct 2007
    • 15997

    #2
    Hello,

    The Text Compare generates a report that is based on lines. You could include Show Context as an option to get equal lines that are nearby, which should also grab the node lines.

    We do include on conversion out of the box to Tidy the xml nodes, but this will still place data on different lines than the node name. If you know of another command line conversion to tidy nodes to the same line, then this could be plugged into BC4 as a custom format.
    Aaron P Scooter Software

    Comment

    • rmnrdi
      Enthusiast
      • Dec 2017
      • 33

      #3
      I guess what I'm understanding is why BC alters the xml to begin with. If it's only doing a text comparison, why does it break up the nodes instead of just comparing it as is?

      <node name> node inner text </node name>

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 15997

        #4
        Hello,

        By default, BC4 does not alter the XML structure, but if an additional file format was installed (XML Tidied), then it would as part of the tidy process.

        If you re-enable the View menu -> File Info status bar (which appears at the top of each pane), we could verify which File Format is being activated based on a new screenshot. Or if you click the Format button in the toolbar you can double check it's Conversion tab. The Tools menu -> File Formats dialog controls which format is used automatically by default in the file view or for Rules-based comparisons; the topmost in the ordered list associated with *.xml (black text) for the corresponding Text format (white icon) would be used. Any formats listed with red text have a format overriding them above the list. The default is XML, and has a Factory Defaults button to restore defaults if it has had a conversion added. You can also clone it first with a Save As (and place the clone lower in the list so it isn't used automatically) to still have it available for manual use.
        Aaron P Scooter Software

        Comment

        • rmnrdi
          Enthusiast
          • Dec 2017
          • 33

          #5
          So I changed my xml comparison session to plain xml while unchecking all the other formats and that took care of the formatting in BC, but when I run the script, it still does the html report as if it was still tidy or sorted.

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 15997

            #6
            Hello,

            If you close BC4 and re-open it, are the defaults set globally to be used by default if you open a new, blank Folder Compare or Text Compare, and then load your folders/files and generate the report from the graphical interface?

            In your Tools menu -> File Formats, I would suggest leaving other items enabled, but find the XML format and make sure it is set to Factory Defaults. If you are still having trouble, use your Tools menu -> Export to back up all of your current settings, then (once backed up), use the Tools menu -> Restore Factory Defaults dialog, uncheck all items but File Formats, and set all File Formats back to defaults and delete all existing file formats Enabled.
            Aaron P Scooter Software

            Comment

            • rmnrdi
              Enthusiast
              • Dec 2017
              • 33

              #7
              If I reopen a new folder compare it doesn't format the output in BC correctly.

              But I don't want a blank folder comparison, I want to use the session I created.

              I don't understand what you're asking me to do.

              I set xml back to factory defaults and it wiped all of the text I set up as unimportant. Do I have to go in and type all those back in again?

              Comment

              • rmnrdi
                Enthusiast
                • Dec 2017
                • 33

                #8
                UPDATE:
                I deleted Tidied and Sorted. The XML is now formatted correctly.

                Although, in the future, you may want to warn someone that all their unimportant text is about to be wiped before the reset to factory defaults. I didn't really even need to do that. The competing formats just needed to be deleted.

                As always, thanks for your help.

                Comment

                • Aaron
                  Team Scooter
                  • Oct 2007
                  • 15997

                  #9
                  True, it would revert grammar settings as well if reverting a format to default. Sorry about that. If you select the format and clone it with Save As first, then you can revert the original format and keep the copy. This assumes setting Factory Defaults per format in the File Formats dialog, and not via the global Restore Factory Defaults dialog under the Tools menu.
                  Aaron P Scooter Software

                  Comment

                  • rmnrdi
                    Enthusiast
                    • Dec 2017
                    • 33

                    #10
                    No problem. It only took 3 hours to put back in...just kidding.

                    Thanks again!

                    Comment

                    Working...