Menu

#1291 Plugin to display XML files

Trunk
closed-accepted
Plugins (55)
5
2014-08-20
2005-06-13
No

This is a plugin to show and easily compare XML files in
WinMerge.
I wrote it because I need to compare a large number of
xml files which has been produced by Microsofts XML
DOM and it allways writes the entire file in one line,
making it virtually impossible to compare different
versions.

The plugin will only work on valid XML files, and as a
bonus it will tell you whats wrong with the XML file if it is
not valid.

I am using the expat parser found at
http://sourceforge.net/projects/expat/ to parse the XML.

I did not implement all the possible expat handlers,
simply because I did not need them for any XML files I
tested with.

I placed the ExpatLib under WinMerge/Plugins/ExpatLib
but I imagine it could be used for other purposes as well
(like parsing a WinMerge project file), so maybe that's
not the best place for it?

The plugin will not try to repack the xml, it will be saved
like it's shown in WinMerge.

I tested this on 2.0, 2.2 and 2.3 it works on all versions,
but I suggest we put it in the trunk only.

This fixes [ 1216649 ] Display xml files with uniform
indenting

One little detail caught my attention while coding this
plugin: The strings in a plugin cannot be localized!

Discussion

  • Christian List

    Christian List - 2005-06-13

    Plugin and expat lib

     
  • Kimmo Varis

    Kimmo Varis - 2005-06-13

    Logged In: YES
    user_id=631874

    > I placed the ExpatLib under WinMerge/Plugins/ExpatLib

    Yes, it should be really in WinMerge/Src/??. Project files
    should use real xml parser, currently we are simply finding
    some elements from file. Also I think we should later have
    options export/import as XML files. Color options etc are
    painful to set again and again.

     
  • elsapo

    elsapo - 2005-06-15

    Logged In: YES
    user_id=1195173

    I tried this, and it breaks up an xml file I have somewhat,
    but I still have at least one line with over 100,000
    characters on the line.

     
  • Christian List

    Christian List - 2005-06-16

    Logged In: YES
    user_id=609728

    That sounds strange, it works well for my xml files.
    But as I stated above, I did not implement *all* the available
    handlers. Maybe your file has some xml stuff that none of
    mine has?
    For instance: None of my xml files has CDATA sections, so I
    didn't add that handler.
    If I can have a look at your file, I'll debug and see what I can
    do. If it's a large file you don't want to publicize too much,
    then send it to christian dot list at gmail dot com

     
  • elsapo

    elsapo - 2005-06-16

    Logged In: YES
    user_id=1195173

    Its not entirely fixable.

    The open element tag alone is several thousand characters
    (eg, from <something attr=... to the > ending the open
    element tag and starting the actual element content). You
    could add code to break long open element tags -- in the
    code following the "Process all attributes" comment.

    But, the element body is text that is tens of thousands of
    characters long, and it is questionable to break that up, as
    it will change the actual content I believe!

     
  • Christian List

    Christian List - 2005-06-16

    Logged In: YES
    user_id=609728

    Breaking up the attributes is indeed a possibility. I see two
    obvious ways to do this:
    1. Put a linebreak for every 5 (or some other number)
    attributes.
    2. Put a linebreak for each 80 (or some other number)
    characters of attributes.
    I am not sure what is best?

    Breaking up text in the element body is a bad idea, so I don't
    think there is much we can do about that one.

     
  • elsapo

    elsapo - 2005-06-16

    Logged In: YES
    user_id=1195173

    (The sample XML file I was looking at was a .dtsx file,
    which is a SQL Server 2005 SSIS package -- the new version
    of SQL Server DTS.)

     
  • Christian List

    Christian List - 2005-06-18

    Logged In: YES
    user_id=609728

    Okay, here is the second try.

    I have moved ExpatLib to WinMerge/Src/ExpatLib like Kimmo
    suggested.

    I added linebreaks for attributes, I decided to break for each 5
    attributes or 80 characters whatever comes first.

    I had a look at some .dtsx files, and they have some pretty
    long lines of text just like Perry has pointed out. But I don't
    think we should even try to break them up anyway. So this
    version is about as good as it gets.

     
  • Christian List

    Christian List - 2005-06-18

    Second try

     
  • Christian List

    Christian List - 2005-06-28

    Logged In: YES
    user_id=609728

    I comitted this to CVS, so it can hopefully be included in the
    next beta.

    Checking in Plugins/list_of_sources.txt;
    /cvsroot/winmerge/WinMerge/Plugins/list_of_sources.txt,v <--
    list_of_sources.txt
    new revision: 1.3; previous revision: 1.2
    done
    Checking in Plugins/readme.txt;
    /cvsroot/winmerge/WinMerge/Plugins/readme.txt,v <--
    readme.txt
    new revision: 1.15; previous revision: 1.14
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/DisplayXMLFiles.cpp,v
    done
    Checking in
    Plugins/src_VCPP/DisplayXMLFiles/DisplayXMLFiles.cpp;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/DisplayXMLFiles.cpp,v <-- DisplayXMLFiles.cpp
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/DisplayXMLFiles.def,v
    done
    Checking in
    Plugins/src_VCPP/DisplayXMLFiles/DisplayXMLFiles.def;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/DisplayXMLFiles.def,v <-- DisplayXMLFiles.def
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/DisplayXMLFiles.dsp,v
    done
    Checking in
    Plugins/src_VCPP/DisplayXMLFiles/DisplayXMLFiles.dsp;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/DisplayXMLFiles.dsp,v <-- DisplayXMLFiles.dsp
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/DisplayXMLFiles.dsw,v
    done
    Checking in
    Plugins/src_VCPP/DisplayXMLFiles/DisplayXMLFiles.dsw;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/DisplayXMLFiles.dsw,v <-- DisplayXMLFiles.dsw
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/DisplayXMLFiles.idl,v
    done
    Checking in
    Plugins/src_VCPP/DisplayXMLFiles/DisplayXMLFiles.idl;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/DisplayXMLFiles.idl,v <-- DisplayXMLFiles.idl
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/DisplayXMLFiles.rc,v
    done
    Checking in
    Plugins/src_VCPP/DisplayXMLFiles/DisplayXMLFiles.rc;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/DisplayXMLFiles.rc,v <-- DisplayXMLFiles.rc
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/Resource.h,v
    done
    Checking in Plugins/src_VCPP/DisplayXMLFiles/Resource.h;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/Resource.h,v <-- Resource.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/StdAfx.cpp,v
    done
    Checking in Plugins/src_VCPP/DisplayXMLFiles/StdAfx.cpp;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/StdAfx.cpp,v <-- StdAfx.cpp
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/StdAfx.h,v
    done
    Checking in Plugins/src_VCPP/DisplayXMLFiles/StdAfx.h;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/StdAfx.h,v <-- StdAfx.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/WinMergeScript.cpp,v
    done
    Checking in
    Plugins/src_VCPP/DisplayXMLFiles/WinMergeScript.cpp;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/WinMergeScript.cpp,v <-- WinMergeScript.cpp
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/WinMergeScript.h,v
    done
    Checking in
    Plugins/src_VCPP/DisplayXMLFiles/WinMergeScript.h;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/WinMergeScript.h,v <-- WinMergeScript.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayX
    MLFiles/typeinfoex.h,v
    done
    Checking in Plugins/src_VCPP/DisplayXMLFiles/typeinfoex.h;
    /cvsroot/winmerge/WinMerge/Plugins/src_VCPP/DisplayXML
    Files/typeinfoex.h,v <-- typeinfoex.h
    initial revision: 1.1
    done
    Checking in Src/readme.txt;
    /cvsroot/winmerge/WinMerge/Src/readme.txt,v <--
    readme.txt
    new revision: 1.1734; previous revision: 1.1733
    done
    RCS file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/ascii.h,v
    done
    Checking in Src/ExpatLib/ascii.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/ascii.h,v <--
    ascii.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/asciitab.h,v
    done
    Checking in Src/ExpatLib/asciitab.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/asciitab.h,v <--
    asciitab.h
    initial revision: 1.1
    done
    RCS file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/expat.h,v
    done
    Checking in Src/ExpatLib/expat.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/expat.h,v <--
    expat.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/expat_externa
    l.h,v
    done
    Checking in Src/ExpatLib/expat_external.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/expat_external.h,v
    <-- expat_external.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/expat_static.d
    sp,v
    done
    Checking in Src/ExpatLib/expat_static.dsp;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/expat_static.dsp,v
    <-- expat_static.dsp
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/iasciitab.h,v
    done
    Checking in Src/ExpatLib/iasciitab.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/iasciitab.h,v <--
    iasciitab.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/internal.h,v
    done
    Checking in Src/ExpatLib/internal.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/internal.h,v <--
    internal.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/latin1tab.h,v
    done
    Checking in Src/ExpatLib/latin1tab.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/latin1tab.h,v <--
    latin1tab.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/nametab.h,v
    done
    Checking in Src/ExpatLib/nametab.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/nametab.h,v <--
    nametab.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/utf8tab.h,v
    done
    Checking in Src/ExpatLib/utf8tab.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/utf8tab.h,v <--
    utf8tab.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/winconfig.h,v
    done
    Checking in Src/ExpatLib/winconfig.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/winconfig.h,v <--
    winconfig.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmlparse.c,v
    done
    Checking in Src/ExpatLib/xmlparse.c;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmlparse.c,v <--
    xmlparse.c
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmlrole.c,v
    done
    Checking in Src/ExpatLib/xmlrole.c;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmlrole.c,v <--
    xmlrole.c
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmlrole.h,v
    done
    Checking in Src/ExpatLib/xmlrole.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmlrole.h,v <--
    xmlrole.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmltok.c,v
    done
    Checking in Src/ExpatLib/xmltok.c;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmltok.c,v <--
    xmltok.c
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmltok.h,v
    done
    Checking in Src/ExpatLib/xmltok.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmltok.h,v <--
    xmltok.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmltok_impl.c
    ,v
    done
    Checking in Src/ExpatLib/xmltok_impl.c;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmltok_impl.c,v
    <-- xmltok_impl.c
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmltok_impl.h
    ,v
    done
    Checking in Src/ExpatLib/xmltok_impl.h;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmltok_impl.h,v
    <-- xmltok_impl.h
    initial revision: 1.1
    done
    RCS
    file: /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmltok_ns.c,v
    done
    Checking in Src/ExpatLib/xmltok_ns.c;
    /cvsroot/winmerge/WinMerge/Src/ExpatLib/xmltok_ns.c,v <--
    xmltok_ns.c
    initial revision: 1.1
    done

     
  • Christian List

    Christian List - 2005-06-28
    • assigned_to: nobody --> christianlist
    • status: open --> closed-accepted
     
  • elsapo

    elsapo - 2005-07-25

    Logged In: YES
    user_id=1195173

    I think this didn't get added to the Plugins/dlls subdirectory.

     
  • elsapo

    elsapo - 2005-07-25

    Logged In: YES
    user_id=1195173

    I'm opening separate bugs on issues with this; no point in
    putting them here against the patch, because this plugin is
    part of cvs now.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.