Current location: Hot Scripts Forums » General Web Coding » JavaScript » how to break a line in xml file using javascript?


how to break a line in xml file using javascript?

Reply
  #1 (permalink)  
Old 01-06-12, 12:27 AM
Natzjordaan Natzjordaan is offline
New Member
 
Join Date: Jan 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
how to break a line in xml file using javascript?

Hey guys

I export data from Javascript to Xml file. I have tried several ways to break a line in xml file like document.write("<br/>"); or document.writeln(); etc, but seem it is impossible.

Maybe you can give me a solution......

Look at below:

XML File:

<?xml version="1.0"?>
<DATA>
<Cust><Select>Debit Card</Select></Cust><Cust>[User>Jan</User></Cust>DATA>

I want to break <Cust> from another <Cust>.

Javascript:

function ok_click() {
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
xmlDoc.async = false;
xmlDoc.load("data.xml");
if (xmlDoc.readyState == 4 && xmlDoc.parseError.errorCode == 0) {
var root = xmlDoc.documentElement;

var e1 = document.getElementById("Select1");
var _account_type = xmlDoc.createTextNode(e1.options[e1.selectedIndex].value);

var e2 = document.getElementById("Select2");
var _user = xmlDoc.createTextNode(e2.options[e2.selectedIndex].value);


var account_type = xmlDoc.createNode(1, "Select", "");
var user = xmlDoc.createNode(1, "User", "");


account_type.appendChild(_account_type);
user.appendChild(_user);


var cust = xmlDoc.createNode(1, "Cust", "");

cust.appendChild(account_type);
document.write("<br/>");
cust.appendChild(user);


root.appendChild(cust);

SaveXML(xmlDoc, "data.xml");
alert("Save!");
}
}
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Ajax to retrieve and hold variables from PHP file - then pass to Javascript file for calculati spalton JavaScript 0 10-05-11 08:57 AM
Random line from a txt file Bahamut666 PHP 3 06-10-11 04:12 PM
Why is it when I run my script on my windows computer stormshadow Other Languages 1 02-24-09 02:21 AM
Hello all, can you help me? K4ot1K Other Languages 2 01-23-09 05:23 AM
Write in a XML file with php pallabmondal123 PHP 2 04-15-06 05:34 AM


All times are GMT -5. The time now is 02:09 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.