我在哪里可以找到亚马逊发布的 S3 XSD(XML 架构定义)?

Where can I find Amazon's published S3 XSD (XML Schema Definition)?

我的一个应用程序,使用 REST API 与 Amazon S3 服务器交互,对服务器执行 "Delete Multiple" 操作并遇到错误响应:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
    <Code>MalformedXML</Code>
    <Message>The XML you provided was not well-formed or did not validate against our published schema</Message>
    <RequestId>6FA...D61</RequestId>
    <HostId>E5G...uhg=</HostId>
</Error>

引用Amazon documentation

This happens when the user sends malformed xml (xml that doesn't conform to the published xsd) for the configuration. The error message is, "The XML you provided was not well-formed or did not validate against our published schema."

我应用的某些删除键包含可能会导致问题的编码字符。因此,我想查看 Amazon 发布的架构 (XSD) 文件本身,运行 它通过验证器来确定问题所在。

在哪里可以找到亚马逊 XSD 文件?

可以在这里找到:http://doc.s3.amazonaws.com/2006-03-01/AmazonS3.xsd
(另请参阅 http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingSOAPOperations.html

AmazonS3.xsd is available, but also consult the Amazon Simple Storage Service API Reference:

最后,特别是考虑到您对 编码字符 的担忧,请注意您的请求有可能实际上格式不正确,因此 XSD 验证开始发挥作用。 (请参阅 Well-formed vs Valid XML。)他们的 API 文档中提供的示例就是这种情况,它会引发您收到的相同错误:

Example 3: Malformed XML in the Request

This example shows how Amazon S3 responds to a request that includes a malformed XML document.

Sample Request

The following requests sends a malformed XML document (missing the Delete end element).

POST /?delete HTTP/1.1
Host: bucketname.S3.amazonaws.com
Accept: */*
x-amz-date: Wed, 30 Nov 2011 03:39:05 GMT
Content-MD5: p5/WA/oEr30qrEEl21PAqw==
Authorization: AWS AKIAIOSFODNN7EXAMPLE:W0qPYCLe6JwkZAD1ei6hp9XZIee=
Content-Length: 104
Connection: Keep-Alive

<Delete>
  <Object>
    <Key>404.txt</Key>
  </Object>
  <Object>
    <Key>a.txt</Key>
  </Object>

Sample Response

The response returns the Error messages that describe the error.

HTTP/1.1 200 OK
x-amz-id-2: P3xqrhuhYxlrefdw3rEzmJh8z5KDtGzb+/FB7oiQaScI9Yaxd8olYXc7d1111ab+
x-amz-request-id: 264A17BF16E9E80A
Date: Wed, 30 Nov 2011 03:39:32 GMT
Content-Type: application/xml
Server: AmazonS3
Content-Length: 207

<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>MalformedXML</Code>
  <Message>The XML you provided was not well-formed or did not 
           validate against our published schema</Message>
  <RequestId>91F27FB5811111F</RequestId>
  <HostId>LCiQK7KbXyJ1t+tncmjRwmNoeeRNW1/ktJ61IC8kN32SFXJx7UBhOzseJCixAbcD</HostId>
</Error>