Configuration

The tree structure introduced in the CSV example can be configured according to FlatTree's XML configuration schema http://flattree.sourceforge.net/schema/flattree-0.5.xsd :


<?xml version="1.0" encoding="UTF-8"?>
<flattree
	xmlns="http://flattree.sourceforge.net/schema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://flattree.sourceforge.net/schema
	                    http://flattree.sourceforge.net/schema/flattree-0.5.xsd "
>
	<delimited-node>
		<name>Header</name>
		<delimiter>&#10;</delimiter>

		<nodes>
			<delimited-node>
				<name>Row</name>
				<delimiter>&#10;</delimiter>
		
				<leaves>
					<delimited-leaf>
						<name>Version</name>
						<delimiter>,</delimiter>
					</delimited-leaf>
					<escaped-delimited-leaf>
						<name>Release date</name>
						<delimiter>,</delimiter>
						<escape>\</escape>
					</escaped-delimited-leaf>
					<quoted-delimited-leaf>
						<name>Codename</name>
						<delimiter>,</delimiter>
						<quote-required>true</quote-required>
					</quoted-delimited-leaf>
				</leaves>
			</delimited-node>
			<delimited-node>
				<name>Unknown</name>
				<delimiter>&#10;</delimiter>
			</delimited-node>
		</nodes>
	</delimited-node>
</flattree>

      

Reading a tree configuration with flattree.config.FlatTree :

public Node readTree(InputStream input) throws IOException {
  return new FlatTree(input).getRoot();
}