dotnet/msbuild

XmlPoke strips out DTD

Open

#5,815 创建于 2020年10月20日

在 GitHub 查看
 (0 评论) (4 反应) (0 负责人)C# (1,364 fork)batch import
bughelp wantedtriaged

仓库指标

Star
 (5,062 star)
PR 合并指标
 (平均合并 11天 7小时) (30 天内合并 125 个 PR)

描述

Issue Description

When modifying an XML file that contains DTD using the XmlPoke task the DTD is stripped out in the resulting XML file.

Steps to Reproduce

The following sample writes an XML file with DTD to the disk. It serves as input for the XmlPoke task which modifies the content and writes a new XML file. Comparing the two XML files shows that the modified file no longer contains the DTD.

<?xml version="1.0" encoding="UTF-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="Build">
    <PropertyGroup>
      <XmlFileOriginal>original.xml</XmlFileOriginal>
      <XmlFileModified>modified.xml</XmlFileModified>
      <XmlContent>
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;https://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist d1p1:version=&quot;&quot; xmlns:d1p1=&quot;1.0&quot;&gt;
  &lt;dict&gt;
    &lt;key&gt;archiveVersion&lt;/key&gt;
    &lt;string&gt;1&lt;/string&gt;
  &lt;/dict&gt;
&lt;/plist&gt;
      </XmlContent>
    </PropertyGroup>
    <WriteLinesToFile File="$(XmlFileOriginal)" Lines="$(XmlContent)" Overwrite="true" />
    <WriteLinesToFile File="$(XmlFileModified)" Lines="$(XmlContent)" Overwrite="true" />
    <XmlPoke XmlInputPath="$(XmlFileModified)" Query="/plist/dict/key" Value="test" />
  </Target>
</Project>

Expected Behavior

The file modified by the XmlPoke task contains the DTD just like before the modification.

贡献者指南