Hello guys,
Here is my workaround and a little explanation about a possible cause. First, the code. Sadly, I was unable to make Python spit out a not-only-seemingly valid file. I fired up my rudimentary PowerShell skills, and I made a script that generates the xml. It is ugly and possibly otherwise bad code, so use with caution. I'm not experienced in PS, so there are probably much nicer solutions. But it works, and I'm OK with this.
It takes the following arguments (in this order): the new version number as a string; the absolute path of the directory where the release files are stored; the name of the main executable (without path).
Here is the script (I can't enable BBCode to format nicely, sorry):
$newversion = $args[0]
$doc = New-Object xml$addversion = $doc.AppendChild($doc.CreateElement("Versions")).AppendChild($doc.CreateElement("AddVersion"))$version = $doc.CreateElement("Version")$version.set_InnerText($newversion)$addversion.AppendChild($version)$dirname = $args[1]$directories = @($dirname)$directories += Get-ChildItem -Recurse $dirname | Where {$_.psIsContainer -eq $true} | foreach-object -process { $_.FullName }$exename = $args[2]
foreach($d in $directories){ if ($d -eq $dirname) { $dir = "basedir" } else { $dir = "basedir" + "\" + $d.Substring($d.LastIndexOf('\')+1) } $node_files = $doc.CreateElement("Files") $node_files.SetAttribute("dir", $dir) $flist = Get-ChildItem $d | foreach-object -process { $_.FullName }
foreach ($f in $flist) { if (![System.IO.File]::Exists($f)) { continue; } $node_f = $doc.CreateElement("File") $node_f.SetAttribute("source", $f) $node_files.AppendChild($node_f) | Out-Null if ([System.IO.Path]::GetFileNameWithoutExtension($f) -eq $exename) { $node_f.SetAttribute("execute", "after") $node_f.SetAttribute("startstyle", "normal") $node_f.SetAttribute("waitforexit", "false") } } $addversion.AppendChild($node_files) | Out-Null}
$writer = New-Object System.Xml.XmlTextWriter("version.xml", [System.Text.Encoding]::UTF8)$writer.Formatting = [System.Xml.Formatting]::Indented$doc.Save($writer)$writer.Close()
A possible cause: The XML 1.0 specification bans certain UTF-8 characters. The Python minidom module, which I used to write the xml, outputs proper UTF-8 and well-formed xml, but not neccessarily valid XML due to these banned characters. See this: http://maxharp3r.wordpress.com/2008/05/15/pythons-minidom-xml-and-illegal-unicode-characters/Now, I did try the solution in this blog, and another one from another site, but they didn't help. This can be an encoding issue, or the absence or presence of a BOM (depending on what wybuild excepts).
Hope this helps someone.