How can I use Blast XML output in my program?
This page describes how to get Java objects from Blast results XML file
in a few simple steps.
Steps similar to those described below could also be applied to use
output from any other bioinformatics related services, capable of
returning results in XML format.
Acquire Blast output in XML format
It can be done in various ways, including saving manual Blast search
results in XML format or by using biojava’s
Blast output XML file should look like this (note the root element
<!DOCTYPE BlastOutput PUBLIC “-//NCBI//NCBI BlastOutput/EN” “NCBI_BlastOutput.dtd”>
Acquire referenced schema files
You might need referenced schema files: NCBI_BlastOutput.dtd,
NCBI_BlastOutput.mod.dtd and NCBI_Entity.mod.dtd (they can be
downloaded from 1).
Generate necessary Java classes
It can be done using xjc tool (part of Java Architecture for XML Binding
(JAXB)), which accepts an XML schema and generates Java classes. The
generated classes contain properties, which map to the XML elements
defined in the schema.
xjc can be used from command line
or as a Maven plugin 3.
Command line usage example: