开发者

XML Namespace declaration NOT at root element?

I've got a XML snippet that needs to look like:

<Item xmlns="uuid:e5fe5e94-392a-4750-a487-88c473b6759e">
  <title>test name</title>
  <subtitle>subtitle text</subtitle>
  &l开发者_C百科t;shortDescription />
  <longDescription />
  <node1 xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:title="title test"
  xlink:href="test" />
  <large>test large</large>
  <small>test small</small>
</Item>

Instead, the XML that I've got using XmlSerializer.Serialize outputs the following when I add the XmlSerializerNamespaces to the Serialize call:

<Item xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="uuid:e5fe5e94-392a-4750-a487-88c473b6759e">
  <title>test name</title>
  <subtitle>subtitle text</subtitle>
  <shortDescription />
  <longDescription />
  <node1 xlink:type="simple" xlink:title="title test"
  xlink:href="test" />
  <large>test large</large>
  <small>test small</small>
</Item>

Note that the xmlns:xlink namespace is at the Root element, instead of the platform element. Any ideas how to get the namespace to appear on the correct element instead of the Root?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜