-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generating XML values for ASCII characters like newline or cr #57
Comments
@joshnuss Sorry should have been more specific about why I want to do this. We are pulling Amazon S3 bucket data, specifically a list of objects in the bucket, which is returned as XML. If our customer managed to make an object in with a '\r' (or other funky ASCII character) in the object key name (which is do-able, although not recommended, in S3), then we'd like the accurate name (by "accurate" I mean '\r' not altered/mapped to '\n') so that we can turn around and use that object name is something like a delete request. As it is right now we can't delete these funkily-named objects. Here's a specific example of what I am talking about:
Note the " " ('\r') at the end of the Key. |
Thanks for the clarification, When your parser parses Because running |
@joshnuss Our parser (which right now is SweetXml) does convert Running
AWS guidance on this is documented in "Creating object key names (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html) - see in particular the section "XML related object key constraints". Duplicating that here:
So net-net, if there was a way that XmlBuilder could be motivated to do this for
|
We could add it to the list of escaped string patterns, see xml_builder/lib/xml_builder.ex Lines 403 to 409 in 5b5ae47
Do you wanna open a PR? Keep in mind, this is a package that many apps are dependent on, so I hesitate to change the output and cause extra working for anyone. |
Amazon s3 key names with ASCII chars like \n or \r are expected to be mapped in XML data to like "& # 13; " or "& # 10 ;" (added spaces to ensure all would be seen here) or the like. Can I motivate XmlBuilder to generate that? When I use
XmlBuilder.generate
with character data with those special characters in it, it is not happening like this:...where I would like it to generate:
I looked in the tests to see if there are any examples of this and I did not see any...
Thanks in advance for any help on this.
The text was updated successfully, but these errors were encountered: