本文整理匯總了Java中dr.xml.XMLParser.addXMLObjectParser方法的典型用法代碼示例。如果您正苦於以下問題:Java XMLParser.addXMLObjectParser方法的具體用法?Java XMLParser.addXMLObjectParser怎麽用?Java XMLParser.addXMLObjectParser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dr.xml.XMLParser
的用法示例。
在下文中一共展示了XMLParser.addXMLObjectParser方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import dr.xml.XMLParser; //導入方法依賴的package包/類
public static void main(String[] args) throws ParserConfigurationException, IOException, SAXException, XMLParseException {
XMLParser parser = new XMLParser(false, true, true, null);
parser.addXMLObjectParser(new TaxonParser());
parser.addXMLObjectParser(new TaxaParser());
parser.addXMLObjectParser(new AttributeParser());
parser.addXMLObjectParser(new DateParser());
parser.parse(new FileReader(new File(args[0])), true);
Taxa taxa = (Taxa)parser.getRoot().getChild(0);
System.out.println("Found " + taxa.getTaxonCount() + " taxa");
GreatCircleDistances distances = new GreatCircleDistances(taxa, "location");
Statistic statistic = distances.getDistanceStatistic(true);
for (int i = 0; i < statistic.getDimension(); i++) {
System.out.println(statistic.getStatisticValue(i));
}
}
示例2: main
import dr.xml.XMLParser; //導入方法依賴的package包/類
public static void main(String[] args) throws ParserConfigurationException, IOException, SAXException, XMLParseException {
XMLParser parser = new XMLParser(true, true);
parser.addXMLObjectParser(new TaxonParser());
parser.addXMLObjectParser(new TaxaParser());
parser.addXMLObjectParser(new AttributeParser());
parser.addXMLObjectParser(new DateParser());
parser.parse(new FileReader(new File(args[0])), true);
Taxa taxa = (Taxa)parser.getRoot().getChild(0);
System.out.println("Found " + taxa.getTaxonCount() + " taxa");
GreatCircleDistances distances = new GreatCircleDistances(taxa, "location");
Statistic statistic = distances.getDistanceStatistic(true);
for (int i = 0; i < statistic.getDimension(); i++) {
System.out.println(statistic.getStatisticValue(i));
}
}