Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I am using X2JS for converting an XML file into a JSON object. Some XML tags contain HTML tags inside it.

<xmltag>I am the data <strong>available</strong> for sale now</xmltag>

Now I don’t want the HTML tag strong to get converted into a JSON object. When I use the variable JsonObj.xmltag it should return I am the data <strong>available</strong> for sale now.

I need to stop converting the HTML tags into JSON objects and allow only non-HTML tags to convert.

share|improve this question

closed as off-topic by Alex, Vidar S. Ramdal, Jacob Jan Tuinstra, Al E., Sathya Apr 3 at 8:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "It is a question about creating/developing a web application." – Vidar S. Ramdal, Al E., Sathya
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

The source file is bad. Data inside XML tags should be wrapped in CDATA.

<xmltag><![CDATA[I am the data <strong>available</strong> for sale now]]></xmltag>

X2JS doesn't support blacklisting certain tags. So you would have to either find an alternative, or change the source xml to appropiate XML standard.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.