Il https://github.com/sara-nl/js-webdav-client non ha funzionato per me
Ho usato jQuery per leggere un file XML:
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);
},
});
},
});
},
});
},
});
},
});
Se si desidera importare altri file di xml cercarlo qui: http://api.jquery.com/jQuery.ajax/
In data4/svnSpecs
puoi trovare ogni parola chiave che hai usato all'interno del tuo xml - fai lo stesso come con xmlString
Con a = xmlString.find("Member");
si ottiene un array con tutti i membri oggetto denominato del xml se lo fai a[0].textContent = "Harry";
si imposta il contenuto del primo oggetto all'interno del tuo xmlString a Harry -> si può solo fare un drawTable()
seguito per aggiornare il vostro tavolo
EDIT: All'interno del drawTable()
methode si hanno a che fare il a.find("")
, var list = [];
e list.push("html text for a table")
ed un $("#membertable").html(list);
di scrivere everthing nella tabella esistente "membertable"
il hashBase
è importante per commettere. Non ho finito con il commit ma quasi. codice attuale e processo è qui: how to do SVN http-request checkin/commit within html
Quale tipo di codice JavaScript si desidera utilizzare? JavaScript in un browser oder ad es. node.js? – TimWolla
Javascript in un browser. Mi piacerebbe fare una sorta di visualizzazione rapida/modifica per un repository SVN (e senza fare affidamento su un server PHP/Java per fare il lavoro). –
In realtà sto avendo la stessa domanda, ma volevo fare DIFF in questo modo - fornendo un modo per mostrare le modifiche per una determinata revisione senza passare attraverso i comandi basati sul server.Matthieu: l'hai finalmente fatto funzionare? Sei in grado di fare anche DIFF? –