【问题标题】:namespace not loading correctly命名空间未正确加载
【发布时间】:2013-03-08 04:48:49
【问题描述】:

我正在通过本地文件读取 xml 命名空间。当我输出时,我得到了

 "


在命名空间中。我做错了什么?

示例命名空间看起来像

  • xmlns="urn:rosettanet:specification:interchange:ShipmentReceiptNotification:xsd:schema:02.02" xmlns:dacc="urn:rosettanet:specification:domain:Procurement:AccountClassification:xsd:codelist:01.03"

我正在加载命名空间如下:

string contents = File.ReadAllText("loadNamespaces.txt");

XmlNode ShipmentReceiptNotification0Node = xmlDoc.CreateElement("ShipmentReceiptNotification", contents);

【问题讨论】:

  • 你想完成什么?这太疯狂了。
  • 我有一个有 100 个 xmlns 的命名空间:名称以 ...\.xsd 结尾>
  • 你想完成什么?为什么需要这些命名空间?
  • 你拥有的不是命名空间。我不知道你有什么,但你做错了什么。

标签: c# xml namespaces


【解决方案1】:

CreateElement方法中,第二个参数只是命名空间。只是“urn:rosettanet:specification:interchange:ShipmentReceiptNotification:xsd:schema:02.02”部分。

【讨论】:

  • 我该如何处理其他 100 个 xmlns:dacc 插入名称?
  • +1。 @user1354345,目前还不清楚“其他 100 个 xmlns”来自哪里以及您为什么关心它们。
  • 在整个 xml 中都使用了前缀。我相信 xml 命名空间声明来自多部分命名空间
  • 你是什么意思,“多部分命名空间”?
猜你喜欢
  • 1970-01-01
  • 2014-10-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-13
  • 2017-05-28
相关资源
最近更新 更多