Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I stop QXmlStreamWriter from escaping quotation marks?
    primarykey
    data
    text
    <p>Let me begin by expressing my understanding that what I'm trying to do is <strong>not</strong> normal, nor is it typically well advised. I'm fully aware that in normal XML, the <code>"</code> character is reserved. </p> <p>I'm generating <code>.vcxproj</code> files to use in Visual Studio 2010, using a Qt application. I'm taking advantage of the <code>QXmlStreamWriter</code> class to write the XML needed for the project file. However, I'm running into a problem due to Microsoft's non-compliance with the XML standard.</p> <p>In <code>CustomBuild</code> elements, the user needs to specify the command for building the file. In the case of Qt projects within Visual Studio, you end up with something like this:</p> <pre><code> &lt;Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"&gt;"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o "..\myproj\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_SQL_LIB -DQT_OPENGL_LIB -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_SVG_LIB "-I." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtXml" "-I$(QTDIR)\include\QtSql" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\Qt3Support" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtTest" "-I..\myproj"&lt;/Command&gt; </code></pre> <p>Yucky, but <em>c'est la vie</em>, especially with Microsoft. Unfortunatey, my <code>QXmlStreamWriter</code> object produces this (fully compliant) output:</p> <pre><code> &lt;Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"&gt;$(QTDIR)\bin\moc.exe&amp;quot; &amp;quot;%(FullPath)&amp;quot; -o &amp;quot;..\myproj\moc_%(Filename).cpp&amp;quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_SQL_LIB -DQT_OPENGL_LIB -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_SVG_LIB &amp;quot;-I.&amp;quot; &amp;quot;-I$(QTDIR)\include&amp;quot; &amp;quot;-I$(QTDIR)\include\QtCore&amp;quot; &amp;quot;-I$(QTDIR)\include\QtGui&amp;quot; &amp;quot;-I$(QTDIR)\include\QtXml&amp;quot; &amp;quot;-I$(QTDIR)\include\QtSql&amp;quot; &amp;quot;-I$(QTDIR)\include\QtOpenGL&amp;quot; &amp;quot;-I$(QTDIR)\include\Qt3Support&amp;quot; &amp;quot;-I$(QTDIR)\include\QtSvg&amp;quot; &amp;quot;-I$(QTDIR)\include\QtTest&amp;quot; &amp;quot;..\myproj&amp;quot;&lt;/Command&gt; </code></pre> <p>Naturally, Visual Studio isn't impressed. What are my options here? I could probably read back the file and un-escape it, but that doesn't sound particularly efficient or intelligent.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload