question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
highsourcecommented, Mar 15, 2019

I’m on FOSSGIS2019 so I can’t reply promptly.

Technically this

<content lang="de"><![CDATA[<p>Something<latex>$m \ge 1 g$</latex> text.</p>]]></content>

is exactly the same as this

<content lang="de">&lt;p&gt;Something &lt;latex&gt;$m \ge 1 g$&lt;/latex&gt; text.&lt;/p&gt;<content>

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 &lt;s, &gt;s, &apos;es and &amp;s then automatically create a CDATA-section.
What do you think?

0reactions
Veganizercommented, Mar 15, 2019

I just had an idea. Maybe you like: https://github.com/highsource/jsonix/pull/215

This would allow the user to do a conditional CDATA by regex.

if ((this.asCDATA && this.CDATAcondition == null) || (this.asCDATA && value.match(new RegExp(this.CDATAcondition)) ))

Read more comments on GitHub >

github_iconTop Results From Across the Web

Technical Support - CData Software
We provide premium technical support via email and phone. All Premium emails and calls are given priority over any standard support questions. Responses...
Read more >
Technical Support - CData Arc
We provide standard technical support via email. We do our best to answer the ...
Read more >
Contact Us - CData Software
Global Sales and Support. Billing & Pending Order Inquiries. Mon-Fri, 9am- 6pm EST (800) 235-7250 (within US) (919) 928-5214 (outside US) sales@cdata.com ...
Read more >
Contact Us - CData Software
Please use the form below to send us your questions, comments, and suggestions. For technical support please submit a specific Online Support Request....
Read more >
Online Help Files - CData Software
Online Help Files. Each online help file offers extensive overviews, samples, walk-throughs, and API documentation. Drivers & Data Connectors ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found