Skip to content
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

XmlLocation response not handling multiple tags of the same name correctly #51

Closed
sprak3000 opened this issue Oct 16, 2014 · 0 comments
Closed

Comments

@sprak3000
Copy link
Contributor

Working with the XML returned from here, the XML returned contains multiple tags of the same name:

<cast gid="1324597141" lang="DE">
  <role>Daisuke Jigen</role>
  <person id="22762">Tilo Schmitz</person>
</cast>
<cast gid="1413111110" lang="DE">
  <role>Inspector Zenigata</role>
  <person id="28552">Stefan Staudinger</person>
</cast>
<cast gid="4109027170" lang="DE">
  <role>Hardyman/Arsene Lupin</role>
  <person id="30167">Tommi Piper</person>
</cast>

The resulting model contains this:

                    [cast] => Array
                        (
                            [role] => Daisuke Jigen
                            [person] => Array
                                (
                                    [@attributes] => Array
                                        (
                                            [id] => 22762
                                        )

                                    [value] => Tilo Schmitz
                                )

                            [0] => Array
                                (
                                    [role] => Inspector Zenigata
                                    [person] => Array
                                        (
                                            [@attributes] => Array
                                                (
                                                    [id] => 28552
                                                )

                                            [value] => Stefan Staudinger
                                        )

                                )

                            [1] => Array
                                (
                                    [role] => Hardyman/Arsene Lupin
                                    [person] => Array
                                        (
                                            [@attributes] => Array
                                                (
                                                    [id] => 30167
                                                )

                                            [value] => Tommi Piper
                                        )

                                )

...

Expected: That first cast tag in the XML would have its contents encapsulated into item 0 in the array returned by getting the model's cast key.

e.g.,

                    [cast] => Array
                        (
                            [0] => Array
                                (
                                    [role] => Daisuke Jigen
                                    [person] => Array
                                        (
                                            [@attributes] => Array
                                                (
                                                    [id] => 22762
                                                )

                                            [value] => Tilo Schmitz
                                        )

                                )

                            [1] => Array
                                (
                                    [role] => Inspector Zenigata
                                    [person] => Array
                                        (
                                            [@attributes] => Array
                                                (
                                                    [id] => 28552
                                                )

                                            [value] => Stefan Staudinger
                                        )

                                )

...
sprak3000 added a commit to sprak3000/guzzle-services that referenced this issue Oct 16, 2014
Adds attributes to non-leaf elements. Elements with the same name will now be in a proper numerically indexed array rather than having the first element having its child elements as non-numeric keys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants