0

reading XML from asp file and taking the response into javascript variable, we are getting XML with line breaks. below is the code iam using.

var s = <% response.write getDefaultProductArea().xml %>;

Response:

 var s = <productarea>
<name>OneSite</name>
<logo width="130" height="34">/multishell_cb/images/products/onesite.png</logo>
<tabset>onesite.xml</tabset>
<actionbar>defaultOnesite.xml</actionbar>
<show-if/>
<default-if>default</default-if>
    </productarea>;

but we need the XML value in single line as shown below.

var s = ' <productarea> <name>OneSite</name><logo width="130" height="34">/multishell_cb/images/products/onesite.png</logo><tabset>onesite.xml</tabset><actionbar>defaultOnesite.xml</actionbar><show-if/><default-if>default</default-if></productarea>';

Please suggest...

1
  • Why you need XML in single line? What is difference? And it's not answer, but why do not use ASP.NET? Commented Sep 16, 2011 at 7:14

1 Answer 1

1
var s = '<% response.write Replace(getDefaultProductArea().xml, vbCrLf, "") %>';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.