我在 Windows 上运行以下代码片段:
root = Base.source_dir()
s = read(joinpath(root,"dialog.glade"), String)
# b = GtkBuilder(filename=joinpath(root, "dialog.glade")) # works fine
b = GtkBuilder(buffer=s) # error
...get objects, etc
我得到以下信息:
LoadError: Error on line 77 char 2: Document must begin with an element (e.g. <book>)
我究竟做错了什么?
重现故障的最小间隙文件:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkDialog" id="win">
</object>
</interface>
这有 8 行,最后一行是空行。报告的错误在第 8 行 char 2 处。