JuliaCloud / XMLDict.jl

XMLDict implements a simple Associative interface for XML documents.
Other
33 stars 11 forks source link

Unable to parse one-layer deep strings #23

Open mattBrzezinski opened 4 years ago

mattBrzezinski commented 4 years ago

I recently came across this problem when trying to get the location of an AWS S3 Bucket. XMLDict appears to not be able to parse one-layer deep strings (for lack of better terminology?)

using XMLDict

xml_response = """
           <?xml version="1.0" encoding="UTF-8"?>
           <LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">eu-west 1</LocationConstraint>"""

parse_xml(xml_response)
XMLDict.XMLDictElement with 0 entries

However, if the xml_response is two-layers deep it works fine:

using XMLDict

 xml_response = """
           <?xml version="1.0" encoding="UTF-8"?>
           <LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Location>eu-west 1</Location></LocationConstraint>"""

parse_xml(xml_response)
XMLDict.XMLDictElement with 1 entry:
  "Location" => "eu-west 1"
mattBrzezinski commented 4 years ago

Following-up using the xml_dict() function will resolve this issue for one-layer deep structs.