-
-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
No CData #187
No CData #187
Conversation
$doCData = $this->currentMetadata->xmlElementCData; | ||
/*if ($this->currentMetadata->name == 'name') { | ||
var_dump($this->currentMetadata); | ||
}*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be removed
…t to be enclosed inside CDATA Also fixed a bug where property metadata was not pushed onto the stack
…is method always serializes data into a text node. DateTimeHandler supports that newly added feature.
So when you set cdata=false but the string contains xml control characters, you get invalid xml?! |
I think it makes more sense to have an option on the serialization context (similar to setSerializeNull()) to only add CDATA when it's needed, and not per-property. |
Have you tried this? I think any special characters will just get escaped. |
IMO you get invalid XML. The reason why the text is not parsed is that parsing each node for invalid characters is really expensive in terms of performance. |
Without
With
But expected:
|
Yes, that's expected. please read above. You must specify cdata attribute where invalid xml text is expected. |
I've defaulted the cdata to true to keep BC with existing serializer metadata. Although it's a bit annoying setting it to false on most of the string properties.
Added visitSimpleString into the XmlSerialization visitor, so Handlers can use that when serializing into the xml if they know that what is beeing serialized doesn0t need to be inside cdata
This one replaces #119