Repository: rusoto/rusoto (language: rust)

Issue:
"Expected characters" error when string value is wrapped in a CData
I have this in as SQS ReceiveMessageResult response:

```
<MessageAttribute>
     <Name>encoding</Name>
    <Value>
        <DataType>String</DataType>
        <StringValue><![CDATA[gzip]]></StringValue>
    </Value>
</MessageAttribute>
```

rusoto is throwing an "Expected characters" response when it gets to the `StringValue` because the XML event it's expecting is `Characters` and it's get a `CData`.

This response came from `localstack`'s SQS implementation, so it's a bug on `localstack`'s part too, but I personally think that rusoto should handle this successfully instead of throwing a parse error.

I'm drafting a PR to fix this, which should be open momentarily.


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7aa00ade549..9e835bdc4ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ## [Unreleased]
 
 (Please put changes here)
+- CDATA sections are now treated like strings
 
 ## [0.44.0] - 2020-06-01
 
diff --git a/rusoto/core/src/proto/xml/util.rs b/rusoto/core/src/proto/xml/util.rs
index 34f816514f4..cf6b203bf33 100644
--- a/rusoto/core/src/proto/xml/util.rs
+++ b/rusoto/core/src/proto/xml/util.rs
@@ -91,10 +91,12 @@ pub fn characters<T: Peek + Next>(stack: &mut T) -> Result<String, XmlParseError
             return Ok("".to_string());
         }
     }
-    if let Some(Ok(XmlEvent::Characters(data))) = stack.next() {
-        Ok(data)
-    } else {
-        Err(XmlParseError::new("Expected characters"))
+    match stack.next() {
+        Some(Ok(XmlEvent::Characters(data))) |
+        Some(Ok(XmlEvent::CData(data))) => {
+            Ok(data)
+        },
+        _ => Err(XmlParseError::new("Expected characters")),
     }
 }
 


Test patch: