Break up node traversal functions, to ensure we're processing the correct XML elements.
Previously, the same callback would be used for all XML elements. This could cause error if an element with the same name occurred at different parts of the document tree.
Improved error checking
Previously, many calls to aws_xml_node_as_body() weren't being checked for error.
Replace ~aws_xml_get_top_level_tag()~ and ~aws_xml_get_top_level_tag_with_root_name()~ with aws_xml_get_body_at_path()
~aws_xml_get_top_level_tag()~ didn't check the name of the root node
~aws_xml_get_top_level_tag_with_root_name()~ was clunky to use (IMHO)
so replace with an API that can retrieve an element at any depth (not just 2), checking names the whole way, and with a nicer API (IMHO).
new function gives aws_byte_cursor instead of aws_string, the user was usually just deleting it afterwards, which made their error-handling more complicated.
Trivial stuff:
Remove unused functions ~aws_s3_list_objects_operation_new()~ and ~aws_s3_initiate_list_parts()~
aws_replace_quote_entities() returns aws_byte_buf by value, instead of as out-param
Some functions take aws_byte_cursor by value, instead taking aws_string * or aws_byte_buf * or aws_byte_cursor * by pointer
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue The XML API was hard to use right, leading to bugs like this: https://github.com/awslabs/aws-c-s3/issues/328
Description of changes:
aws_xml_node_as_body()
weren't being checked for error.aws_xml_get_body_at_path()
aws_byte_cursor
instead ofaws_string
, the user was usually just deleting it afterwards, which made their error-handling more complicated.aws_replace_quote_entities()
returnsaws_byte_buf
by value, instead of as out-paramaws_byte_cursor
by value, instead takingaws_string *
oraws_byte_buf *
oraws_byte_cursor *
by pointerBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.