All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jaeksoft.searchlib.crawler.web.browser.get_xpath.js Maven / Gradle / Ivy

Go to download

OpenSearchServer is a powerful, enterprise-class, search engine program. Using the web user interface, the crawlers (web, file, database, ...) and the REST/RESTFul API you will be able to integrate quickly and easily advanced full-text search capabilities in your application. OpenSearchServer runs on Windows and Linux/Unix/BSD.

The newest version!
this.getElementTreeXPath = function(element) {
	var paths = [];
	for (; element && element.nodeType == 1; element = element.parentNode) {
		var index = 0;
		for ( var sibling = element.previousSibling; sibling; sibling = sibling.previousSibling) {
			if (sibling.nodeType == Node.DOCUMENT_TYPE_NODE)
				continue;
			if (sibling.nodeName == element.nodeName)
				++index;
		}
		var tagName = element.nodeName.toLowerCase();
		var pathIndex = (index ? "[" + (index + 1) + "]" : "");
		paths.splice(0, 0, tagName + pathIndex);
	}
	return paths.length ? "/" + paths.join("/") : null;
};
return this.getElementTreeXPath(arguments[0]);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy