function loadReferer() {
document.getElementById("url").value = document.URL;
}
function getXMLHttpRequest() {
/* Don't forget to ask for security before to create the object.
try {
// netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch (e) {
alert("Permission UniversalBrowserRead denied.");
}*/
/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
@end @*/
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest();
}
return xmlHttp;
}
function RDFXHTMLParser(datasource) {
this.ds = datasource;
}
RDFXHTMLParser.prototype.parseDOMNode = function (currentNode, uriContext) {
var context = uriContext;
/* try {
var test = currentNode.hasAttributes();
} catch (e) {
alert(currentNode + " - " + e);
return;
}*/
if (currentNode.hasAttributes()) {
var about = currentNode.getAttribute("about");
if (about) {
context = about;
}
// ...
// if (currentNode.nodeType == Node.ELEMENT_NODE) {
if ((currentNode.nodeName.toLowerCase() == "a") || (currentNode.nodeName.toLowerCase() == "link") ) {
var rel = currentNode.getAttribute("rel");
if (rel) {
var href = currentNode.getAttribute("href");
this.ds.Assert(this.ds.GetNode(context), this.ds.GetPredicate(rel), this.ds.GetNode(href), true);
}
var rev = currentNode.getAttribute("rev");
if (rev) {
var href = currentNode.getAttribute("href");
this.ds.Assert(this.ds.GetNode(href), this.ds.GetPredicate(rev), this.ds.GetNode(context), true);
}
}
// }
// value>
var prop = currentNode.getAttribute("property");
if (prop) {
var content = currentNode.getAttribute("content");
if (content) {
this.ds.Assert(this.ds.GetNode(context), this.ds.GetPredicate(prop), this.ds.GetLiteral(content), true);
} else {
this.ds.Assert(this.ds.GetNode(context), this.ds.GetPredicate(prop), this.ds.GetLiteral(currentNode.firstChild.nodeValue), true);
}
}
}
/* parse children */
if (currentNode.hasChildNodes()) {
var children = currentNode.childNodes;
for (var i=0; i';
};
DummyDatasource.prototype.GetPredicate = function (uri) {
return '<' + uri + '>';
};
DummyDatasource.prototype.Flush = function () {
if (this.output) {
alert(this.output);
} else {
alert("no triples");
}
};
function TableDatasource(table) {
this.table = table;
var trs = table.childNodes;
for(var i=0; i