We are trying to automate changing variable values by directly changing them in the .hmxp file.
After parsing hmxp, changing stuff and writing it back to file, the project still opens, but the TOC is empty.
(Using ElementTree in Python to change the relevant XML entries and writing back to file).
I'm not sure what XML code got damaged in the process and further, what code would even be relevant for the TOC in the first place.
The only obvious thing I found was the big block of HTML code getting escaped by parsing it.
Code: Select all
<config-group name="TOPICTEMPLATES">
<config-value name="Default" translate="true"><![CDATA[<%DOCTYPE%>
<html>
<head>
<title><%TOPIC_TITLE%></title>
<meta name="generator" content="Help & Manual" />
<meta name="keywords" content="<%TOPIC_KEYWORDS%>" />
<meta http-equiv="Content-Type" content="text/html; charset=<%DOCCHARSET%>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="<%TOPIC_DESCRIPTION%>"
(...) />
Code: Select all
<config-group name="TOPICTEMPLATES">
<config-value name="Default" translate="true"><%DOCTYPE%>
<html>
<head>
<title><%TOPIC_TITLE%></title>
<meta name="generator" content="Help &amp; Manual" />
<meta name="keywords" content="<%TOPIC_KEYWORDS%>" />
<meta http-equiv="Content-Type" content="text/html; charset=<%DOCCHARSET%>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="<%TOPIC_DESCRIPTION%>" />
Other parts of the code are not affected by this since they are already escaped "properly"
For example:
Code: Select all
<config-value name="title" translate="true"><%TITLE%></config-value>
The other files (topics, baggage, maps, .xsd, .xsl) were not altered.
Can someone shed light on this behaviour?