gpt4 book ai didi

c# - 添加没有命名空间的带前缀的起始元素

转载 作者:行者123 更新时间:2023-11-30 23:07:12 33 4
gpt4 key购买 nike

有没有办法像这样在 XmlWriter 中使用 WriteStartElement 函数:

XmlWriter.WriteStartElement("prefix", "name", null);

Error occured: System.ArgumentException: 'Unable to use prefix with empty namespace.'

我不想在创建元素时设置 namespace URI。
稍后将在创建其他属性时通过 WriteAttributeString() 添加它。

最佳答案

不,未绑定(bind)到命名空间 URI 的命名空间前缀是无意义的,并且在 namespace-well-formed 中是不允许的XML 文档。

关于c# - 添加没有命名空间的带前缀的起始元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47519279/

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