【发布时间】:2009-06-29 19:54:20
【问题描述】:
我尝试使用 domainpeople.com API,但我需要使用 XML。
目前我有一个错误提示“未找到 apiProtocol”,我猜我的 Xml 文档格式不正确。
当前发送的xml是:
<apiProtocol version="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNameSpaceSchemaLocation="checkrequest.xsd">
<checkRequest user="ifuzion" password="fish4gold121" reference="123456789">
<domain name="google.com" />
</checkRequest>
</apiProtocol>
显然<?xml?> 部分没有打印出来。
我的代码基本上类似于:
XDocument xDocument = new XDocument(
new XDeclaration("1.0", "UTF-8", "yes"),
new XElement("Books"));
(为了简单起见,我删除了我的代码,但结构完全相似)。
XDocument 没有打印出<?xml?> 部分有什么原因吗?似乎使用 XmlDocument 它可以工作,但不能使用 XDocument ...任何提示?
【问题讨论】:
标签: asp.net xml c#-3.0 linq-to-xml