The https://github.com/sara-nl/js-webdav-client didn't work for me
I used jQuery to read an XML file:
var URL = window.location.href;
var baseURL = URL.substring(0, URL.lastIndexOf('/'));
$.ajax({
type: "OPTIONS",
url: baseURL,
contentType: "text/xml", //for other files look up the api link below
headers: {Depth: "0"},
data: '<?xml version="1.0" encoding="utf-8" ?><D:options xmlns:D="DAV:"><D:activity-collection-set></D:activity-collection-set></D:options>',
success: function(data1, status, jqxhr){
latestRev = jqxhr.getResponseHeader('SVN-Youngest-Rev');
$.ajax({
type: "PROPFIND",
url: baseURL + '/!svn/rvr/' + latestRev,
contentType: "text/xml",
headers: {Depth: "0"},
data: '<?xml version="1.0" encoding="utf-8" ?><propfind xmlns="DAV:"><prop><resourcetype xmlns="DAV:"/></prop></propfind>',
success: function(data2, status, jqxhr){
$.ajax({
type: "OPTIONS",
url: baseURL,
contentType: "text/xml",
headers: {Depth: "0"},
data: '<?xml version="1.0" encoding="utf-8" ?><D:options xmlns:D="DAV:"><D:activity-collection-set></D:activity-collection-set></D:options>',
success: function(data3, status, jqxhr){
$.ajax({
type: "REPORT",
url: baseURL + "/!svn/me",
contentType: "text/xml",
data: '<S:update-report xmlns:S="svn:"><S:include-props>yes</S:include-props><S:src-path>/svn/check</S:src-path><S:target-revision>' + latestRev + '</S:target-revision><S:depth>unknown</S:depth><S:entry depth="infinity" rev="' + latestRev + '"></S:entry></S:update-report>',
success: function(data4,status,jqxhr){
svnSpecs = data4;
$.ajax({
type: "GET",
url: '/svn/check/!svn/rvr/' + latestRev + '/KickOff.xml',
converters: {"text xml": function(obj) {
hashBase = calcMD5(obj);
return obj;
}},
cache: false,
async: false,
success: function(data5, status, jqxhr){
hashdata5 = calcMD5(data5);
xmlString = $($.parseXML(data5));
drawTable(xmlString);
},
});
},
});
},
});
},
});
},
});
If you want to import other files than xml look it up here: http://api.jquery.com/jQuery.ajax/
In data4/svnSpecs
you can find every keyword you used within your xml - just do the same as with the xmlString
With a = xmlString.find("Member");
you get an array with every object named member of the xml
if you do a[0].textContent = "Harry";
you set the content of the first object within your xmlString to Harry --> you can just do an drawTable()
afterwards to refresh your table
EDIT:
Within the drawTable()
methode you have to do the a.find("")
, var list = [];
and list.push("html text for a table")
and an $("#membertable").html(list);
to write everthing in the existing table "membertable"
The hashBase
is important for commiting.
i'm not done with the commit but nearly.
current code and process is over here: how to do SVN http-request checkin/commit within html