{"action":"opened","issue":{"url":"https://api.github.com/repos/nathanmac/Parser/issues/21","labels_url":"https://api.github.com/repos/nathanmac/Parser/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/nathanmac/Parser/issues/21/comments","events_url":"https://api.github.com/repos/nathanmac/Parser/issues/21/events","html_url":"https://github.com/nathanmac/Parser/issues/21","id":127178319,"number":21,"title":"Bug or feature? XML reply with 1 entry behaves differently with n entries","user":{"login":"andreasba","id":15323226,"avatar_url":"https://avatars.githubusercontent.com/u/15323226?v=3","gravatar_id":"","url":"https://api.github.com/users/andreasba","html_url":"https://github.com/andreasba","followers_url":"https://api.github.com/users/andreasba/followers","following_url":"https://api.github.com/users/andreasba/following{/other_user}","gists_url":"https://api.github.com/users/andreasba/gists{/gist_id}","starred_url":"https://api.github.com/users/andreasba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreasba/subscriptions","organizations_url":"https://api.github.com/users/andreasba/orgs","repos_url":"https://api.github.com/users/andreasba/repos","events_url":"https://api.github.com/users/andreasba/events{/privacy}","received_events_url":"https://api.github.com/users/andreasba/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-18T08:41:18Z","updated_at":"2016-01-18T08:41:18Z","closed_at":null,"body":"Good morning,\r\n\r\nI am not sure whether this is a bug or a feature or if I am using Parser in a wrong way.\r\n\r\nTake the following XML:\r\n\r\n```XML\r\n<?xml version=\"1.0\"?>\r\n<GetFeedSubmissionListResponse xmlns=\"http://mws.amazonaws.com/doc/2009-01-01/\">\r\n  <GetFeedSubmissionListResult>\r\n    <HasNext>false</HasNext>\r\n    <FeedSubmissionInfo>\r\n      <FeedProcessingStatus>_IN_PROGRESS_</FeedProcessingStatus>\r\n      <FeedType>_POST_FBA_INBOUND_CARTON_CONTENTS_</FeedType>\r\n      <FeedSubmissionId>40737016817</FeedSubmissionId>\r\n      <StartedProcessingDate>2016-01-17T21:13:27+00:00</StartedProcessingDate>\r\n      <SubmittedDate>2016-01-17T21:12:53+00:00</SubmittedDate>\r\n    </FeedSubmissionInfo>\r\n    <FeedSubmissionInfo>\r\n      <FeedProcessingStatus>_DONE_</FeedProcessingStatus>\r\n      <FeedType>_POST_FBA_INBOUND_CARTON_CONTENTS_</FeedType>\r\n      <FeedSubmissionId>40736016817</FeedSubmissionId>\r\n      <StartedProcessingDate>2016-01-17T21:12:38+00:00</StartedProcessingDate>\r\n      <SubmittedDate>2016-01-17T21:12:06+00:00</SubmittedDate>\r\n      <CompletedProcessingDate>2016-01-17T21:13:13+00:00</CompletedProcessingDate>\r\n    </FeedSubmissionInfo>\r\n    <FeedSubmissionInfo>\r\n      <FeedProcessingStatus>_DONE_</FeedProcessingStatus>\r\n      <FeedType>_POST_FBA_INBOUND_CARTON_CONTENTS_</FeedType>\r\n      <FeedSubmissionId>40735016817</FeedSubmissionId>\r\n      <StartedProcessingDate>2016-01-17T21:07:07+00:00</StartedProcessingDate>\r\n      <SubmittedDate>2016-01-17T21:07:01+00:00</SubmittedDate>\r\n      <CompletedProcessingDate>2016-01-17T21:07:53+00:00</CompletedProcessingDate>\r\n    </FeedSubmissionInfo>\r\n    <FeedSubmissionInfo>\r\n      <FeedProcessingStatus>_DONE_</FeedProcessingStatus>\r\n      <FeedType>_POST_FBA_INBOUND_CARTON_CONTENTS_</FeedType>\r\n      <FeedSubmissionId>40734016817</FeedSubmissionId>\r\n      <StartedProcessingDate>2016-01-17T19:04:13+00:00</StartedProcessingDate>\r\n      <SubmittedDate>2016-01-17T19:03:55+00:00</SubmittedDate>\r\n      <CompletedProcessingDate>2016-01-17T19:04:54+00:00</CompletedProcessingDate>\r\n    </FeedSubmissionInfo>\r\n  </GetFeedSubmissionListResult>\r\n  <ResponseMetadata>\r\n    <RequestId>608dc493-ca8a-4b4d-99a5-7775269e2ac6</RequestId>\r\n  </ResponseMetadata>\r\n</GetFeedSubmissionListResponse>\r\n```\r\nIf I parse this using\r\n```PHP\r\n$responseItems = $requestStatus->parsedResponse['GetFeedSubmissionListResult']['FeedSubmissionInfo'];\r\n```\r\nmy $responseItems contain an array of four items from $responseItems[0] to $responseItems[3] where I can access all attributes like FeedSubmissionId for example like  $responseItems[1]['FeedSubmissionId'] - perfect.\r\n\r\nHowever, if the XML response only has ONE FeedSubmissionInfo item, like this:\r\n```XML\r\n<?xml version=\"1.0\"?>\r\n<GetFeedSubmissionListResponse xmlns=\"http://mws.amazonaws.com/doc/2009-01-01/\">\r\n  <GetFeedSubmissionListResult>\r\n    <HasNext>false</HasNext>\r\n    <FeedSubmissionInfo>\r\n      <FeedProcessingStatus>_IN_PROGRESS_</FeedProcessingStatus>\r\n      <FeedType>_POST_FBA_INBOUND_CARTON_CONTENTS_</FeedType>\r\n      <FeedSubmissionId>40737016817</FeedSubmissionId>\r\n      <StartedProcessingDate>2016-01-17T21:13:27+00:00</StartedProcessingDate>\r\n      <SubmittedDate>2016-01-17T21:12:53+00:00</SubmittedDate>\r\n    </FeedSubmissionInfo>\r\n    <FeedSubmissionInfo>\r\n      <FeedProcessingStatus>_DONE_</FeedProcessingStatus>\r\n      <FeedType>_POST_FBA_INBOUND_CARTON_CONTENTS_</FeedType>\r\n      <FeedSubmissionId>40736016817</FeedSubmissionId>\r\n      <StartedProcessingDate>2016-01-17T21:12:38+00:00</StartedProcessingDate>\r\n      <SubmittedDate>2016-01-17T21:12:06+00:00</SubmittedDate>\r\n      <CompletedProcessingDate>2016-01-17T21:13:13+00:00</CompletedProcessingDate>\r\n    </FeedSubmissionInfo>\r\n    <FeedSubmissionInfo>\r\n      <FeedProcessingStatus>_DONE_</FeedProcessingStatus>\r\n      <FeedType>_POST_FBA_INBOUND_CARTON_CONTENTS_</FeedType>\r\n      <FeedSubmissionId>40735016817</FeedSubmissionId>\r\n      <StartedProcessingDate>2016-01-17T21:07:07+00:00</StartedProcessingDate>\r\n      <SubmittedDate>2016-01-17T21:07:01+00:00</SubmittedDate>\r\n      <CompletedProcessingDate>2016-01-17T21:07:53+00:00</CompletedProcessingDate>\r\n    </FeedSubmissionInfo>\r\n    <FeedSubmissionInfo>\r\n      <FeedProcessingStatus>_DONE_</FeedProcessingStatus>\r\n      <FeedType>_POST_FBA_INBOUND_CARTON_CONTENTS_</FeedType>\r\n      <FeedSubmissionId>40734016817</FeedSubmissionId>\r\n      <StartedProcessingDate>2016-01-17T19:04:13+00:00</StartedProcessingDate>\r\n      <SubmittedDate>2016-01-17T19:03:55+00:00</SubmittedDate>\r\n      <CompletedProcessingDate>2016-01-17T19:04:54+00:00</CompletedProcessingDate>\r\n    </FeedSubmissionInfo>\r\n  </GetFeedSubmissionListResult>\r\n  <ResponseMetadata>\r\n    <RequestId>608dc493-ca8a-4b4d-99a5-7775269e2ac6</RequestId>\r\n  </ResponseMetadata>\r\n</GetFeedSubmissionListResponse>\r\n```\r\nThen $responseItems[0]['FeedSubmissionId'] throws an illegal offset error, since the parser (of course?) parsed the response not like $responseItems[0][<all attributes>] but like this: $responseItems[<all attributes>].\r\n\r\nNow I am wondering if this is a bug or works as designed?\r\n\r\nAnd what would be the workaround? Convert the whole xml to a collection and then work with that?\r\n\r\nThanks\r\nAndreas"}}