-
Notifications
You must be signed in to change notification settings - Fork 78
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
CDATA support #214
Comments
Could you please give an example of XMLs an how you‘d like them to be represented in JS.
I‘m a bit puzzled as CDATA is just character data. So this should actually work OTOB, not sure why special support is needed.
… Am 14.03.2019 um 13:50 schrieb Justinizer ***@***.***>:
Dear developers,
I have to use mixed CDATA contents. It means that the node can have CDATA or text or both mixed.
I am not able to change the XSD Schema for a new simply type. For a fast solution I added a regex detection for the use of cdata in the jsonix.js, but I don't think that this is a good solution.
Is there a way to keep CDATA from XML file?
My fast solution:
if (this.asCDATA && value.match(/<.+>/g) != null)
Best regards,
Justin
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
For example: if i convert it to js and back it gets to: Edit: If I turn CDATA on for this simpletype then every node gets CDATA. Even these which hadn't CDATA before. |
Sorry to did bother you. I have researched in other XML to objects Parser. To mix CDATA with normal content is a mistake by XSD Design. I will please the writer of xsd file to change this. Thank you for your fast support! |
I'm on FOSSGIS2019 so I can't reply promptly. Technically this
is exactly the same as this
I understand that these are different cosmetics but technically it is not really relevant. However I can follow that you might be interested in actual cosmetics to make XML more readable. The problem is, however the presentation in the JS side. Somehow you will need to distinguish between normal text and CDATA-text. So improving cosmetics on the XML side might lead to much more complex models on the JS side. Which, in my PoV is a too high price. But here's an idea. Maybe we could implement some automatic that Jsonix automatically produces CDATA sections if the text contains too much markup/special characters? Like if there are more that N |
I think this is a really good idea. |
I reopen it. So we can find a solution for. Should I write some code and do a merge request. Or do you want to write code yourself? |
I just had an idea. Maybe you like: This would allow the user to do a conditional CDATA by regex.
|
Dear developers,
I have to use mixed CDATA contents. It means that the node can have CDATA or text or both mixed.
I am not able to change the XSD Schema for a new simply type. For a fast solution I added a regex detection for the use of cdata in the jsonix.js, but I don't think that this is a good solution.
Is there a way to keep CDATA from XML file?
My fast solution:
if (this.asCDATA && value.match(/<.+>/g) != null)
Best regards,
Justin
The text was updated successfully, but these errors were encountered: