xml - 在哪里可以找到 Amazon 发布的 S3 XSD(XML 架构定义)?

标签 xml amazon-web-services amazon-s3 xsd

我的一个应用程序使用 REST API 与 Amazon S3 服务器交互,对服务器执行了“删除多个”操作并遇到了错误响应:

<?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) 文件本身,通过验证器运行它来确定问题。

在哪里可以找到 Amazon XSD 文件?

最佳答案

AmazonS3.xsd可用,还可咨询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>

关于xml - 在哪里可以找到 Amazon 发布的 S3 XSD(XML 架构定义)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36112946/

相关文章:

c - 新 child 的 xml 缩进和换行符

java - zip文件太大aws lambda java gradle

javascript - 如何使用适用于 Node.js 的 AWS 开发工具包将 Amazon S3 中的所有对象从一个前缀复制/移动到另一个前缀

Python:如何从AWS S3读取和加载Excel文件?

json - 使用 NodeJS 进行深度 xml 解析为 csv

java - 在布局和 ScrollView 底部添加按钮

amazon-web-services - Terraform 未上传新的 ZIP

amazon-web-services - 使用自定义 header 将 CloudFront 限制为特定 IP 范围的 S3 静态网站

python - sam 部署失败并出现错误 存储桶位于此区域 : us-east-2. 请使用此区域到 us-east-2

iphone - 解析具有相同标签的 XML 文件