Sort xml files doesn't work always (followup for Issue 31)

Issue #44 new
Samuel Plentz
created an issue

I wanted to try the new (very useful) feature (Issue 31) to sort xml files before merging them. Unfortunately the result always was empty in my case. (the utf8-file had no bom)

I debugged the file "FileTransforms\msxml.wsc" and found that the following expression "xslt.load(transform) And doc.load(path)" returned false, so that " tidy.StdIn.Write doc.transformNode(xslt)" couldn't be executed.

If xslt.load(transform) And doc.load(path) Then
    tidy.StdIn.Write doc.transformNode(xslt)
End If
Set OpenTextFile = tidy.StdOut

I would suggest to change this part to:

If xslt.load(transform) And doc.load(path) Then
    tidy.StdIn.Write doc.transformNode(xslt)
    Set OpenTextFile = tidy.StdOut
    Set OpenTextFile = sh.Exec("""tidy.exe"" -xml --char-encoding raw -indent --indent-attributes yes --more-preformatted yes --tab-size 4 --indent-spaces 4 -wrap 0 """ & path & """").StdOut
End If

Comments (4)

  1. J Goog

    I also see an empty file if the xml files are stored on a UNC path. The standard XML compare works but not the sort option. I see they've updated the code and in the True portion of the If statement the path variable is not included in the TidyCmdLine so I'm wondering if that was the cause. Tried altering but no change.

  2. jtuc repo owner

    Please edit msxml.wsc and remove the line that reads:

    path = Replace(path, "\\?\", "")

    This line is probably a leftover from messing with some old version of tidy.exe which did not accept long paths.

  3. J Goog

    That results in some very strange behaviour. Modifies the XML content. <ColumnDesc name="kBreakline" dataType="dtBoolean"></ColumnDesc> turns into <ColumnDesc dataType="dtBoolean" name="kBreakline" />

  4. Log in to comment