Changes

Jump to navigation Jump to search
17 bytes added ,  13:14, 24 January 2011
no edit summary
==Overview==
XML documents often rely on Document Type Definitions (DTDDTDs). While parsing a document with BaseX , elements and entities can be checked for validity with respect to that particular DTD.Currently By default, the DTD is only used only for entity resolution.
 XHTML , for example , defines its doctype via the following line:
<pre class="brush:xml">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
</pre>
Fetching <code>xhtml1-strict.dtd</code> obviously involves network traffic. When dealing with single files , this may seem tolerable, but importing large collections benefit from caching these resources. Depending on the remote server , you will experience significant speed improvements when caching DTDs locally.
== XML Entity and URI Resolvers in BaseX ==
BaseX comes with a default URI resolver that is usable out of the box.
To enable entity resolving you have to provide a valid XML Catalog file, so that the parser knows where to look for mirrored DTDs.
A simple working example for XHTML might look like this:
<pre class="brush:xml" start="0">
<?xml version="1.0"?>
</catalog>
</pre>
This rewrites all SystemIds systemIds starting with: ''<nowiki>http://www.w3.org/TR/xhtml1/DTD/</nowiki>'' to ''file:///path/to/dtds/''.
The XHTML DTD <code>xhtml1-strict.dtd</code> and all its linked resources will now be loaded from the specified path.
 
===GUI Mode===
When running BaseX in GUI mode , simply provide the path to your XML Catalog file in the '''Parsing'''-Tab of the Database Creation Dialog.
===Console & Server Mode===
To enable Entity Resolving in Console Mode , specify the following [[options]]:
* <code>SET CATFILE [path]</code>
Now entity resolving is active for the current session. All subsequent <code>ADD</code> commands will use the catalog file to resolve entities.
The '''paths''' to your catalog file and the actual dtds DTDs are either absolute or relative to the ''current working directory''. When using BaseX in Client-Server-Mode , this is relative to the ''server's'' working directory.
===Please Note===
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu