public void writeSentence(TokenStructure syntaxGraph) throws MaltChainedException {
		if (syntaxGraph == null || dataFormatInstance == null) {
			return;
		}
		if (syntaxGraph.hasTokens()) {
			sentenceCount++;
			final PhraseStructure phraseStructure = (PhraseStructure)syntaxGraph;
			try {
				sentenceID.setLength(0);
				sentenceID.append(sentencePrefix);
				if (phraseStructure.getSentenceID() != 0) {
					sentenceID.append(Integer.toString(phraseStructure.getSentenceID()));
				} else {
					sentenceID.append(Integer.toString(sentenceCount));
				}
				writer.write("    <s id=\"");
				writer.write(sentenceID.toString());  
				writer.write("\">\n");
				
				setRootID(phraseStructure);
				writer.write("      <graph root=\"");
				writer.write(rootID.toString());
				writer.write("\" ");
				writer.write("discontinuous=\"");
				writer.write(Boolean.toString(!phraseStructure.isContinuous()));
				writer.write("\">\n");
				
				writeTerminals(phraseStructure);
				if (phraseStructure.nTokenNode() != 1 || rootHandling.equals(RootHandling.TALBANKEN)) {
					writeNonTerminals(phraseStructure);
				} else {
					writer.write("        <nonterminals/>\n");
				}
				writer.write("      </graph>\n");
				writer.write("    </s>\n");
			} catch (IOException e) {
				throw new DataFormatException("The TigerXML writer could not write to file. ", e);
			}
		}
	}