Question

I'm trying to get a page to validate (http://validator.w3.org) and it complains about some xml I have inside a script tag.

How can I resolve this? Am I supposed to have something around the content of my script tag saying "don't look at me"?

Line 68, column 114: end tag for element "STR_PROCESSING" which is not open

>Processing....</STR_Processing>

Code:

<script type="text/javascript" defer="defer">
var sML_XML='<STR_Processing>Processing....</STR_Processing><STR_OK>...';
</script>
Was it helpful?

Solution

You have to place a backslash (\) before the slashes, when it is in a script.
Look here: http://www.htmlhelp.com/tools/validator/problems.html#script

For example:
var test="<b>something<\/b>";
instead of:
var test="<b>something</b>";

This should validate with no errors.

OTHER TIPS

If you are using tag in strings you can do this :

 var yourHTML = "<STR_PROCESSING>YourData<" + "/STR_PROCESSING>";

The correct XML way is to use CDATA section identifiers:

<script type="text/javascript">//<![CDATA[
/* code */
//]]></script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top