gpt4 book ai didi

.net - xmlwriter writedoctype格式化

转载 作者:数据小太阳 更新时间:2023-10-29 02:55:05 28 4
gpt4 key购买 nike

我正在尝试生成此文档类型字符串:

<!DOCTYPE games SYSTEM "transform.dtd">

这是我一直在尝试的:

$writer.WriteDocType("games", $null , "transform.dtd", $null )

我不完全确定如何得到那条确切的线。

最佳答案

PowerShell 中存在一个已知错误: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()

关于.net - xmlwriter writedoctype格式化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4309728/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com