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

What happens to the attributes? #8

Open
judgej opened this issue Jun 28, 2018 · 3 comments
Open

What happens to the attributes? #8

judgej opened this issue Jun 28, 2018 · 3 comments

Comments

@judgej
Copy link

judgej commented Jun 28, 2018

The XML is parsed into a nice structure, but it seems only to parse text nodes into strings, and nested elements into nested objects.

What I don't see, is what happens to any attributes on an element. Are they lost? I don't see them come through in some simple experiments.

@judgej
Copy link
Author

judgej commented Jun 28, 2018

I guess $request->all() (with the middleware) provides the parsed XML with all attributes removed, which may be sufficient for many use-cases. If an API wants to parse the XML in more detail then the raw XML is available through $request->getContent().

@Tucker-Eric
Copy link
Owner

Correct. I think accessing through $request->all() should stay as it is as an array without attributes. Changing the handling of $request->xml(false) to return SimpleXMLElement instead of stdClass would provide a little more flexibility and not strip those attributes. Or should there be another method to retrieve the data with attributes?

@judgej
Copy link
Author

judgej commented Jun 28, 2018

It seems that $request->xml() may not be a binary choice...

array/stdClass/XMLDocoment?

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