File:  [mozdev] / bookmarktools / www / documentation.html
Revision 1.20: download - view: text, annotated - select for diffs - revision graph
Sat Feb 28 08:30:54 2009 UTC (10 years, 2 months ago) by maik
Branches: MAIN
CVS tags: HEAD
- new page layout

    1: <?xml version="1.0" encoding="UTF-8"?>
    2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    3: 
    4: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    5: 	<head>
    6: 		<title>Bookmark Tools</title>
    7: 		<link rel="stylesheet" href="project.css" type="text/css" />
    8: 		
    9: 		<meta http-equiv="Content-Type" content="text/html" />
   10: 		<meta content="text/css" http-equiv="Content-Style-Type" />
   11: 		
   12: 		<script type="text/javascript" src="scripts/shCore.js"></script>
   13: 		<script type="text/javascript" src="scripts/shBrushBash.js"></script>
   14: 		<script type="text/javascript" src="scripts/shBrushCpp.js"></script>
   15: 
   16: 		<script type="text/javascript" src="scripts/shBrushCSharp.js"></script>
   17: 		<script type="text/javascript" src="scripts/shBrushCss.js"></script>
   18: 		<script type="text/javascript" src="scripts/shBrushDelphi.js"></script>
   19: 		<script type="text/javascript" src="scripts/shBrushDiff.js"></script>
   20: 		<script type="text/javascript" src="scripts/shBrushGroovy.js"></script>
   21: 		<script type="text/javascript" src="scripts/shBrushJava.js"></script>
   22: 
   23: 		<script type="text/javascript" src="scripts/shBrushJScript.js"></script>
   24: 		<script type="text/javascript" src="scripts/shBrushPhp.js"></script>
   25: 		<script type="text/javascript" src="scripts/shBrushPlain.js"></script>
   26: 		<script type="text/javascript" src="scripts/shBrushPython.js"></script>
   27: 		<script type="text/javascript" src="scripts/shBrushRuby.js"></script>
   28: 		<script type="text/javascript" src="scripts/shBrushScala.js"></script>
   29: 
   30: 		<script type="text/javascript" src="scripts/shBrushSql.js"></script>
   31: 		<script type="text/javascript" src="scripts/shBrushVb.js"></script>
   32: 		<script type="text/javascript" src="scripts/shBrushXml.js"></script>
   33: 		
   34: 		<link type="text/css" rel="stylesheet" href="styles/shCore.css"/>
   35: 		<link type="text/css" rel="stylesheet" href="styles/shThemeDefault.css"/>
   36: 		
   37: 		<script type="text/javascript">
   38: 			SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
   39: 			SyntaxHighlighter.all();
   40: 		</script>
   41: 	</head>
   42: 	<body>
   43: 		<table style="width: 100%;">
   44: 			<tbody>
   45: 				<tr>
   46: 					<td>
   47: 						<div id="main">
   48: 							<div id="menu-container">
   49: 								<a href="http://www.mozdev.org" title="mozdev.org - free project hosting for the mozilla community">
   50: 									<img src="http://www.mozdev.org/sharedimages/mozdev_tiny.png" width="80" height="15" alt="mozdev.org" />
   51: 								</a>
   52: 								<div id="project-head">Bookmark Tools</div>
   53: 								<div id="project-desc">Developer <a class="simpleLink" href="mailto:maik.gollnick@gmx.de">Maik Gollnick</a></div>
   54: 								<ul id="simple-menu">
   55: 									<li><a href="index.html" title="Home">Home</a></li>
   56: 									<li><a href="installation.html" title="Download">Download</a></li>
   57: 									<li><a href="documentation.html" title="Documentation" class="current">Documentation</a></li>
   58: 									<li><a href="source.html" title="Source Code">Source Code</a></li>
   59: 									<li><a href="bugs.html" title="Bugs">Bugs</a></li>
   60: 									<li><a href="screenshots.html" title="Screenshots">Screenshots</a></li>
   61: 									<li style="float: right;"><div style="color: black;">Hits: <?php include ('counter.php'); ?></div></li>
   62: 								</ul>
   63: 							</div>
   64: 							<div id="menu-line"></div>
   65: 							
   66: 							<div id="content">
   67: 								
   68: 								<div>
   69: 									<h3><a name="Content">Content:</a></h3>
   70: 									<ul>
   71: 										<li><strong>USER GUIDE</strong></li>
   72: 										<li><strong>XPCOM</strong>
   73: 											<ul>
   74: 												<li><a class="simpleLink" href="#HowToIndex">HowTo use the index component</a></li>
   75: 												<li><a class="simpleLink" href="#HowToTidy">HowTo use the tidy component</a></li>
   76: 											</ul>
   77: 										</li>
   78: 										<li><strong>OTHER</strong></li>
   79: 									</ul>
   80: 									<br />
   81: 								</div>
   82: 
   83: 								<div class="separator"></div>
   84: 									
   85: 								<br />
   86: 
   87: 								<h3><a href="#Content"><img src="./images/back.png" alt="back" title="back" /></a><a name="HowToIndex">HowTo use the index component (uses clucene-core-0.9.20)</a></h3>
   88: 								<h4>Writing::</h4>
   89: 								<pre class="brush: js font-size: 80%">
   90: 
   91: 									//initialize file object (location: profile directory)
   92: 									var file = Components.classes["@mozilla.org/file/directory_service;1"]
   93: 												.getService(Components.interfaces.nsIProperties)
   94: 												.get("ProfD", Components.interfaces.nsIFile);
   95: 
   96: 									file.append("index"); //folder named 'index'
   97: 									
   98: 									if(!file.exists() || !file.isDirectory()) 
   99: 										file.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);
  100: 
  101: 									//initialize xpcom
  102: 									var writer = Components.classes["@bookmarktools.mozdev.org/search/indexWriter;1"].createInstance();
  103: 									writer = writer.QueryInterface(Components.interfaces.ICLWriter);
  104: 									
  105: 									//set path
  106: 									writer.setPath(file.path);
  107: 									
  108: 									//create index document
  109: 									var cl_document = new Object();
  110: 									cl_document.primaryKey = "key0";						//this shoud be a unique key
  111: 									cl_document.name = "first document";					//document name
  112: 									cl_document.content = "Hello World!";					//some content
  113: 									
  114: 									//append document
  115: 									writer.appendDocument(
  116: 										cl_document.primaryKey,
  117: 										cl_document.name,
  118: 										cl_document.content
  119: 									);
  120: 									
  121: 									//optimize data
  122: 									writer.optimize();
  123: 									
  124: 								</pre>
  125: 
  126: 								<h4>Searching::</h4>
  127: 								<pre class="brush: js font-size: 80%">
  128: 
  129: 									//initialize xpcom
  130: 									var reader = Components.classes["@bookmarktools.mozdev.org/search/indexReader;1"].createInstance();
  131: 									reader = reader.QueryInterface(Components.interfaces.ICLReader);
  132: 									
  133: 									//set path
  134: 									reader.setPath(file.path); //see section 'Writing'
  135: 									
  136: 									if(reader.exists()){ //check for index data
  137: 										
  138: 										var query = "Hell*";
  139: 										var results = Components.classes["@mozilla.org/array;1"]
  140: 														.createInstance(Components.interfaces.nsIMutableArray);
  141: 										reader.search(query, results);
  142: 										
  143: 										var e = results.enumerate();
  144: 										while (e.hasMoreElements()) {
  145: 											var resultNode = e.getNext().QueryInterface(Components.interfaces.IResultNode);
  146: 											
  147: 											//Object: resultNode
  148: 											//-> resultNode.primaryKey
  149: 											//-> resultNode.score
  150: 											alert(resultNode.primaryKey + "\n" + resultNode.score);
  151: 										}
  152: 										
  153: 									}else {
  154: 										//display message or do nothing
  155: 									}
  156: 									
  157: 								</pre>
  158: 
  159: 								<h4>Lookup::</h4>
  160: 								<pre class="brush: js font-size: 80%">
  161: 
  162: 									//initialize xpcom
  163: 									var reader = Components.classes["@bookmarktools.mozdev.org/search/indexReader;1"].createInstance();
  164: 									reader = reader.QueryInterface(Components.interfaces.ICLReader);
  165: 									
  166: 									//set path
  167: 									reader.setPath(file.path); //see section 'Writing'
  168: 									
  169: 									var results = Components.classes["@mozilla.org/array;1"]
  170: 													.createInstance(Components.interfaces.nsIMutableArray);
  171: 									reader.lookup(results);
  172: 									
  173: 									var e = results.enumerate();
  174: 									while (e.hasMoreElements()) {
  175: 										var lookupNode = e.getNext().QueryInterface(Components.interfaces.ILookupNode);
  176: 										
  177: 										//Object: lookupNode
  178: 										//-> lookupNode.primaryKey
  179: 										//-> lookupNode.name
  180: 										alert(lookupNode.primaryKey + "\n" + lookupNode.name);
  181: 									}
  182: 
  183: 								</pre>
  184: 
  185: 								<h4>Delete documents::</h4>
  186: 								<pre class="brush: js font-size: 80%">
  187: 
  188: 									//initialize xpcom
  189: 									var writer = Components.classes["@bookmarktools.mozdev.org/search/indexWriter;1"].createInstance();
  190: 									writer = writer.QueryInterface(Components.interfaces.ICLWriter);
  191: 									
  192: 									//set path
  193: 									writer.setPath(file.path); //see section 'Writing'
  194: 									
  195: 									//delete documents with index 0, 5 and 2
  196: 									var docs = [0, 5, 2];
  197: 									writer.deleteDocument(docs, docs.length);
  198: 
  199: 								</pre>
  200: 
  201: 								<br />
  202: 
  203: 								<div class="separator"></div>
  204: 								
  205: 								<h3><a href="#Content"><img src="./images/back.png" alt="back" title="back" /></a><a name="HowToTidy">HowTo use the tidy component (uses ctidy version 060405)</a></h3>
  206: 								<h4>Cleanup::</h4>
  207: 								<pre class="brush: js font-size: 80%">
  208: 
  209: 									//initialize xpcom
  210: 									var tidy = Components.classes["@bookmarktools.mozdev.org/repair/tidy;1"].createInstance();
  211: 									tidy = tidy.QueryInterface(Components.interfaces.ITidy);
  212: 									
  213: 									var src = "
  214: 									&lt;html&gt;
  215: 										&lt;head&gt;&lt;/head&gt;
  216: 										&lt;body
  217: 											broken body tag &amp; no entity
  218: 										&lt;/body&gt;
  219: 									&lt;/html>";
  220: 									
  221: 									//result contains the repaired html/xhtml/xml source
  222: 									//otherwise a error message returned
  223: 									var result = tidy.cleanup(src);
  224: 									
  225: 									if(result == "Tidy: no output"){
  226: 										alert("error returned");
  227: 									}else {
  228: 										alert(src);
  229: 									}
  230: 									
  231: 								</pre>
  232: 						
  233: 							</div>
  234: 						</div>
  235: 					</td>
  236: 				</tr>
  237: 				<tr>
  238: 					<td>
  239: 						<div id="footer">
  240: 							<table>
  241: 								<tr>
  242: 									<td>
  243: 										<a href="http://validator.w3.org/check?uri=referer">
  244: 											<img src="http://www.w3.org/Icons/valid-xhtml10-blue"
  245: 											alt="Valid XHTML 1.0 Strict" height="31" width="88" />
  246: 										</a>
  247: 									</td>
  248: 									<td style="width: 100%;">
  249: 										<div style="text-align: center;">
  250: 											Project hosted on <a class="simpleLink" href="http://www.mozdev.org/">mozdev.org</a>.<br/> <a class="simpleLink" href="http://www.mozdev.org/copyright.html">Copyright</a> &copy; 2004. All rights reserved. <a class="simpleLink" href="http://www.mozdev.org/community/terms.html">Terms of Use</a>.
  251: 										</div>
  252: 									</td>
  253: 									<td>
  254: 										<a href="http://jigsaw.w3.org/css-validator/check/referer">
  255: 											<img style="border:0;width:88px;height:31px"
  256: 											src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
  257: 											alt="Valid CSS!" />
  258: 										</a>
  259: 									</td>
  260: 								</tr>
  261: 							</table>
  262: 						</div>
  263: 					</td>
  264: 				</tr>
  265: 			</tbody>
  266: 		</table>
  267: 	</body>
  268: </html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>