我正在尝试生成这个doctype字符串:
<!DOCTYPE games SYSTEM "transform.dtd">这就是我一直在尝试的:
$writer.WriteDocType("games", $null , "transform.dtd", $null )我不是完全确定如何获得准确的行。
发布于 2010-11-30 12:18:16
在PowerShell中有一个已知的bug:passing null to a string parameter results in a String.Empty instead of null.
您可以像这样处理它:
# Given an XML writer of some sort ...
$writer = [system.xml.xmlwriter]::create("$pwd\test.xml")
# Set up the parameters you want to pass to the method:
$params = @("games",$null,"transform.dtd",$null)
# And invoke it using .Net reflection:
$writer.GetType().GetMethod("WriteDocType").Invoke($writer,$params)
# Eventually, close the writer:
$writer.Close()https://stackoverflow.com/questions/4309728
复制相似问题