Ошибка при выполнении 'xml_gconf' формата #43

Closed
opened 3 years ago by icerider · 3 comments
Collaborator
  File "/var/calculate/calculate-utils-4-lib/calculate/templates/format/xml_gconf_format.py", line 57, in __init__
    self._parse_xml_to_dictionary(document_text)
  File "/var/calculate/calculate-utils-4-lib/calculate/templates/format/base_format.py", line 76, in _parse_xml_to_dictionary
    root = fromstring(xml_document_text)
  File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 1316, in XML
    return parser.close()
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
sh-5.0# vi /var/calculate/templates4/merge/gnome-base/gconf/%gconf-tree.xml 
``` File "/var/calculate/calculate-utils-4-lib/calculate/templates/format/xml_gconf_format.py", line 57, in __init__ self._parse_xml_to_dictionary(document_text) File "/var/calculate/calculate-utils-4-lib/calculate/templates/format/base_format.py", line 76, in _parse_xml_to_dictionary root = fromstring(xml_document_text) File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 1316, in XML return parser.close() xml.etree.ElementTree.ParseError: no element found: line 1, column 0 sh-5.0# vi /var/calculate/templates4/merge/gnome-base/gconf/%gconf-tree.xml ```
Poster
Collaborator

Шаблон и целевой файл

Шаблон и целевой файл
Poster
Collaborator

Шаблон

{% calculate format='xml_gconf', append='replace' %}
<?xml version="1.0"?>
<gconf>
	<dir name="schemas">
		<dir name="desktop">
			<dir name="gnome">
				<dir name="background">
					<entry name="picture_filename" mtime="1267285026" type="schema" stype="string" owner="gnome">
						<local_schema locale="C" short_desc="Picture Filename">
							<default type="string">
{% if pkg('media-gfx/dm-themes-calculate') >= '14-r1' %}
								<stringvalue>/usr/share/wallpapers/Calculate-dm/contents/images/{{ main.os.x11.resolution.standard }}.jpg</stringvalue>
{% elif pkg('media-gfx/dm-themes-calculate') < '14-r1' %}
                                                                <stringvalue>/usr/share/wallpapers/dm-{{ main.os.x11.resolution.standard }}.jpg</stringvalue>
{% endif %}
							</default>
							<longdesc>File to use for the background image.</longdesc>
						</local_schema>
					</entry>
				</dir>
			</dir>
		</dir>
		<dir name="system">
			<dir name="storage">
				<dir name="default_options">
					<dir name="ntfs-3g">
						<entry name="mount_options" mtime="1267283808" type="schema" stype="list" list_type="string">
							<local_schema locale="C" short_desc="Default mount options for ntfs-3g fs">
								<default type="list" ltype="string">
										<li type="string">
											<stringvalue> </stringvalue>
										</li>
								</default>
								<longdesc>A list of default mount options for volumes formatted with the ntfs file system using ntfs-3g.</longdesc> </local_schema>
						</entry>
					</dir>
				</dir>
			</dir>
		</dir>
	</dir>
</gconf>

Шаблон ``` {% calculate format='xml_gconf', append='replace' %} <?xml version="1.0"?> <gconf> <dir name="schemas"> <dir name="desktop"> <dir name="gnome"> <dir name="background"> <entry name="picture_filename" mtime="1267285026" type="schema" stype="string" owner="gnome"> <local_schema locale="C" short_desc="Picture Filename"> <default type="string"> {% if pkg('media-gfx/dm-themes-calculate') >= '14-r1' %} <stringvalue>/usr/share/wallpapers/Calculate-dm/contents/images/{{ main.os.x11.resolution.standard }}.jpg</stringvalue> {% elif pkg('media-gfx/dm-themes-calculate') < '14-r1' %} <stringvalue>/usr/share/wallpapers/dm-{{ main.os.x11.resolution.standard }}.jpg</stringvalue> {% endif %} </default> <longdesc>File to use for the background image.</longdesc> </local_schema> </entry> </dir> </dir> </dir> <dir name="system"> <dir name="storage"> <dir name="default_options"> <dir name="ntfs-3g"> <entry name="mount_options" mtime="1267283808" type="schema" stype="list" list_type="string"> <local_schema locale="C" short_desc="Default mount options for ntfs-3g fs"> <default type="list" ltype="string"> <li type="string"> <stringvalue> </stringvalue> </li> </default> <longdesc>A list of default mount options for volumes formatted with the ntfs file system using ntfs-3g.</longdesc> </local_schema> </entry> </dir> </dir> </dir> </dir> </dir> </gconf> ```
Poster
Collaborator

Целевой файл

<?xml version="1.0" ?>
<gconf>
  <dir name="schemas">
    <dir name="desktop">
      <dir name="gnome">
        <dir name="background">
          <entry mtime="1267285026" name="picture_filename" owner="gnome" stype="string" type="schema">
            <local_schema locale="C" short_desc="Picture Filename">
              <default type="string">
                <stringvalue>/usr/share/wallpapers/Calculate-dm/contents/images/1920x1080.jpg</stringvalue>
              </default>
              <longdesc>File to use for the background image.</longdesc>
            </local_schema>
          </entry>
        </dir>
      </dir>
    </dir>
    <dir name="system">
      <dir name="storage">
        <dir name="default_options">
          <dir name="ntfs-3g">
            <entry list_type="string" mtime="1267283808" name="mount_options" stype="list" type="schema">
              <local_schema locale="C" short_desc="Default mount options for ntfs-3g fs">
                <default ltype="string" type="list">
                  <li type="string">
                    <stringvalue>
                    </stringvalue>
                  </li>
                </default>
                <longdesc>A list of default mount options for volumes formatted with the ntfs file system using ntfs-3g.</longdesc>
              </local_schema>
            </entry>
          </dir>
        </dir>
      </dir>
    </dir>
  </dir>
</gconf>

Целевой файл ``` <?xml version="1.0" ?> <gconf> <dir name="schemas"> <dir name="desktop"> <dir name="gnome"> <dir name="background"> <entry mtime="1267285026" name="picture_filename" owner="gnome" stype="string" type="schema"> <local_schema locale="C" short_desc="Picture Filename"> <default type="string"> <stringvalue>/usr/share/wallpapers/Calculate-dm/contents/images/1920x1080.jpg</stringvalue> </default> <longdesc>File to use for the background image.</longdesc> </local_schema> </entry> </dir> </dir> </dir> <dir name="system"> <dir name="storage"> <dir name="default_options"> <dir name="ntfs-3g"> <entry list_type="string" mtime="1267283808" name="mount_options" stype="list" type="schema"> <local_schema locale="C" short_desc="Default mount options for ntfs-3g fs"> <default ltype="string" type="list"> <li type="string"> <stringvalue> </stringvalue> </li> </default> <longdesc>A list of default mount options for volumes formatted with the ntfs file system using ntfs-3g.</longdesc> </local_schema> </entry> </dir> </dir> </dir> </dir> </dir> </gconf> ```
derzeitgeist closed this issue 3 years ago
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: calculate/calculate-utils-4-lib#43
Loading…
There is no content yet.