I am trying to create an XML file, but the XML file needs to be wrapped in nodes... hence, not easy to use append.
Any help with this would be great!!
My XML consists of 2 different node types:
<entry id="1_0">
<title>This is the title</title>
<description>This is the description...</description>
<subName>Publishers Name</subName>
<date>Saturday, June 11th, 2007, 5:46:21 PM</date>
<BorF>bug</BorF>
</entry>
<vote id="1_0">5</vote>
And I've a simple testing page using jQuery to send data (currently static) to a PHP file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script>
$(function(){
$("#addVote").click(function() {
$.ajax({
type: "POST",
url: "saveListData.php",
data: 'url=bugs_features_listdata.xml&listData=\n<vote id="1_2">3</vote>',
async: false,
cache: false,
success: function(data, textStatus) {
if (window.console) console.log(textStatus);
},
complete: function(XMLHttpRequest, textStatus){
if (window.console) console.log(textStatus);
}
});
});
$("#addEntry").click(function() {
$.ajax({
type: "POST",
url: "saveListData.php",
data: 'url=bugs_features_listdata.xml&listData=\n<entry id="1_1">\n\
\t<title>This is the title 1</title>\n\
\t<description>This is the description...</description>\n\
\t<subName>Publishers Name</subName>\n\
\t<date>Saturday, June 11th, 2007, 5:46:21 PM</date>\n\
\t<BorF>bug</BorF>\n\
</entry>',
async: false,
cache: false,
success: function(data, textStatus) {
if (window.console) console.log(textStatus);
},
complete: function(XMLHttpRequest, textStatus){
if (window.console) console.log(textStatus);
}
});
});
});
</script>
</head>
<body>
<a id="addVote" href="#">ADD VOTE</a><br /><br /><a id="addEntry" href="#">ADD ENTRY</a>
</body>
</html>
...that currently appends it to my XML file, but I need the beginning/ending nodes.