Changes

Jump to navigation Jump to search
130 bytes added ,  07:13, 22 September 2011
no edit summary
This article is part of the [[Advanced User's Guide]].It presents various parsers for converting data to XML. ==XML Parsers==
By default, the standard Java [http://download.oracle.com/javase/6/docs/api/javax/xml/parsers/SAXParser.html SAXParser] is used to parse the input XML documents. Some documents may not be fully processed by the default parser. This may e.g. be the case if they are too large or contain too many or incorrect entities.
The internal, built-in XML parser of BaseX is more fault-tolerant than the default parser. Additionally, it allows you to switch off DTD and/or entity parsing. There are two ways to switch to the internal XML parser:
===GUI===
Go to Menu ''Database'' → ''New'', then choose the ''Parsing'' tab and activate ''Use internal XML parser''.
The parsing of entities and DTDs can be turned on/off by clicking on the two check boxes below.
===Command Line===
Turn on the database option [[Options#INTPARSE|INTPARSE]] before parsing documents: <code>SET INTPARSE ON</code>.
Entity and DTD parsing can be changed by modifying the [[Options#DTD|DTD]] options.
==CSV Parser==
BaseX can be used to import CSV document into the database.
===GUI===
Go to Menu ''Database'' → ''New'', choose the ''Parsing'' tab and activate "csv" in the input format combobox.
: Choose the XML format (possible: <code>verbose</code>, <code>simple</code>).
===Command Line===
Turn on the CSV Parser before parsing documents: <code>SET PARSER csv</code>.
SET PARSEROPT encoding=utf-8, lines=true, format=verbose, header=false, separator=comma
==Text Parser==
Plain text can be imported as well:
===GUI===
Go to Menu ''Database'' → ''New'', choose the ''Parsing'' tab and activate "text" in the input format combobox.
: Activate this option to create a <code>&lt;line&gt;...&lt;/line&gt;</code> element for each line of the input text file.
===Command Line===
Turn on the text parser before parsing documents: <code>SET PARSER TEXT</code>.
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu