nivas
nivas

Reputation: 1

remove XML line breaks in javascript/asp

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...

Upvotes: 0

Views: 211

Answers (1)

mVChr
mVChr

Reputation: 50185

var s = '<% response.write Replace(getDefaultProductArea().xml, vbCrLf, "") %>';

Upvotes: 1

Related Questions