Certain xml specifications require a markup declaration to perform a task. One such example is below; a conditional to check a framework version in Wix
<Condition Message="This application requires .NET Framework 4.6.2. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_462_OR_LATER_INSTALLED]]>
</Condition>
While the condition is trivial to build an element for:
def add_net462_prerequisite(self, parent):
condition = ET.SubElement(
parent,
"Condition",
Message="This application requires .NET Framework 4.6.2. "
"Please install the .NET Framework then run this installer again.",
)
I can't seem to find a way to add a "markup declaration" to specify the line
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_462_OR_LATER_INSTALLED]]>
I've gone through the documentation of xml.etree.ElementTree and can't find anything about markup declarations; nor have I found anything via searching the web on markup declarations in that library or lxml's elementree.
A way to add raw text, a markup declaration, or another hack would be acceptable. I'm half considering re-reading the output file, locating the appropriate node and then adding the text programmatically, but I'm hoping it doesn't come to that.
Thank you for any assistance
Note: We're currently using wix 3.14; though this question is really regarding ElementTree.
EDIT: I've also attempted to use ElementTree.fromstring("<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_462_OR_LATER_INSTALLED]]>")
, which fails with a parse error.
Similarly, I've tried the below which, while it runs and builds an Element, that element fails to contain the <![CDATA[Installed OR WIX_IS_NETFRAMEWORK_462_OR_LATER_INSTALLED]]>
condition = ET.fromstring(
' <Condition Message="This application requires .NET Framework 4.6.2. '
'Please install the .NET Framework then run this installer again.">'
' <![CDATA[Installed OR WIX_IS_NETFRAMEWORK_462_OR_LATER_INSTALLED]]>'
' </Condition>'
)
Additional EDIT: It would seem that someone has posted a similar question before that I've finally located (and attempted to mark this as a duplicate of)