-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] add type casting to XML decoding #36482
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
Comments
In theory, this could be done in reverse when encoding the XML also. |
The XmlEncoder use libxml to decode XML, xsi:type is not interpreted by this lib, we must introduce an other php lib to parse this kind of xml like this : https://www.php.net/manual/fr/book.sdo-das-xml.php. |
@lmasforne not sure what you mean, the issue is not suggesting introduction of a new dependency nor otherwise. |
I read how xml is decoded and it use the XmlEncoder class wich use libxml. I dont know if this lib can interpreted 'xsi:type' because when i try to load the xml file upper this lib lauch an error on line 127 here |
I have a typo in my XML example, the third tag is not self-closed. 🙈 I've fixed it now. Even if the lib doesn't support it, it will read the attributes as, well, attributes. They can then get additional interpretation and get casted in a post-processing step. |
This is also related to: #33850 |
Thank you for this suggestion. |
Yup. |
Thank you for this suggestion. |
Yes. |
Thank you for this suggestion. |
Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3 |
Hey, I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen! |
Description
The data coming from XML is always string. Additional support could be added for XML Schema, XML Schema instance type hints, making the decoded information much more correct.
Example
could produce:
but currently produces
The text was updated successfully, but these errors were encountered: