Changes

Jump to navigation Jump to search
2,267 bytes added ,  18:57, 27 December 2010
Created page with "<p>BaseX offers a standalone console mode in which all Commands and XQuery queries can be executed.</p> ==Run the console version== <code>java -cp BaseX*.jar org.basex.Base..."
<p>BaseX offers a standalone console mode in which all [[Commands]]
and XQuery queries can be executed.</p>

==Run the console version==
<code>java -cp BaseX*.jar org.basex.BaseX</code>

==First Steps==
#Start a console and run BaseX.
#Have a look at the different commands with 'help'.
#Create a database with your xml file(s).
#Run your query and receive the results.

==Start of BaseX in console mode==

<p>
Just enter: <code>java -cp BaseX.jar org.base.BaseX</code> on the command line.<br/>
The Java option <code>-Xmx...</code> reserves more memory, and the <code>-h</code> flag of BaseX lists all available flags:
</p>

<pre>
java -Xmx512m -cp BaseX.jar org.basex.BaseX -h

Usage: BaseX [-diosuvVwz] [-cq] [file]
[file] Execute XQuery file
-c<cmd> Execute database command(s)
-d Activate debugging mode
-i<input> Open initial file or database
-o<file> Write output to file
-q<expr> Execute XQuery expression
-s<pars> Set serialization parameter(s)
-u Write updates back to original files
-v/V Show (all) process info
-w Keep whitespaces from source files
-z Skip output of results
</pre>

==Working with the BaseX Console==

<p>After starting the BaseX Console you can type in <code>help</code> to get a list of all
[[Commands|BaseX commands]]. Several commands can be separated by semicolons.</p>

<p>
To evaluate commands without entering the console mode, you can use the
<code>-c</code> option on the command line:
</p>

<pre>
java -cp BaseX.jar org.basex.BaseX -Vc "create db input input.xml; xquery /"

Database 'input' created in 53.64 ms.
<html>
<!-- Header -->
<head id="0">
<title>XML</title>
</head>
<!-- Body -->
<body id="1" bgcolor="#FFFFFF" text="#000000" link="#0000CC">
<h1>Databases &amp; XML</h1>
<div align="right">
<b>Assignments</b>
<ul>
<li>Exercise 1</li>
<li>Exercise 2</li>
</ul>
</div>
</body>
<?pi bogus?>
</html>

Query: /

Compiling:

Result: root()

Parsing: 0.19 ms
Compiling: 9.27 ms
Evaluating: 0.33 ms
Printing: 3.08 ms
Total Time: 12.88 ms
Results: 1 Item
Updated: 0 Items
Printed: 375 Bytes
Memory: 5834 KB

Query executed in 13.25 ms.
</pre>

==See also ==
[[BaseX GUI]]
bueraucrat, Bureaucrats, editor, reviewer, Administrators
907

edits

Navigation menu