public static ResponseList<ContributorFact> createContributorFactList(HttpResponse res) { if (null == res) { return null; } XMLParser parser = new XMLParser(res.asString()); NodeList nodelist = parser.getNodeList("response/result/contributor_fact"); ResponseList<ContributorFact> list = new ResponseListImpl<ContributorFact>(nodelist.getLength(), res); for (int i = 0; i < nodelist.getLength(); i++) { Node node = nodelist.item(i); try { XMLParser childParser = new XMLParser(XMLParser.getXmlStringFromNode(node)); ContributorFact contributorFact = new ContributorFactImpl(childParser, true); list.add(contributorFact); } catch (TransformerFactoryConfigurationError e) { e.printStackTrace(); } catch (TransformerException e) { e.printStackTrace(); } } return list; }
private List<ContributorLanguageFact> createContLangFact(NodeList nodeList) { List<ContributorLanguageFact> list = new ArrayList<ContributorLanguageFact>(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); try { XMLParser childParser = new XMLParser(XMLParser.getXmlStringFromNode(node)); ContributorLanguageFact contributorLangFact = ContributorLanguageFactImpl.createContributorLanguageFact(childParser); list.add(contributorLangFact); } catch (TransformerFactoryConfigurationError e) { e.printStackTrace(); } catch (TransformerException e) { e.printStackTrace(); } } return list; }
private void listInit(XMLParser parser) { contributorId = parser.getLong("contributor_fact/contributor_id/text()"); analysisId = parser.getLong("contributor_fact/analysis_id/text()"); accountId = parser.getLong("contributor_fact/account_id/text()"); contributorName = parser.getString("contributor_fact/contributor_name/text()"); primaryLanguageId = parser.getInt("contributor_fact/primary_language_id/text()"); primaryLanguageNiceName = parser.getString("contributor_fact/primary_language_nice_name/text()"); commentRatio = parser.getFloat("contributor_fact/comment_ratio/text()"); firstCommitTime = parser.getDate("contributor_fact/first_commit_time/text()"); lastCommitTime = parser.getDate("contributor_fact/last_commit_time/text()"); manMonths = parser.getInt("contributor_fact/man_months/text()"); commits = parser.getInt("contributor_fact/commits/text()"); medianCommits = parser.getInt("contributor_fact/median_commits/text()"); contributorLanguageFact = NULLLANGFACT; }
private void init(XMLParser parser) { contributorId = parser.getLong("response/result/contributor_fact/contributor_id/text()"); analysisId = parser.getLong("response/result/contributor_fact/analysis_id/text()"); accountId = parser.getLong("response/result/contributor_fact/account_id/text()"); contributorName = parser.getString("response/result/contributor_fact/contributor_name/text()"); primaryLanguageId = parser.getInt("response/result/contributor_fact/primary_language_id/text()"); primaryLanguageNiceName = parser.getString("response/result/contributor_fact/primary_language_nice_name/text()"); commentRatio = parser.getFloat("response/result/contributor_fact/comment_ratio/text()"); firstCommitTime = parser.getDate("response/result/contributor_fact/first_commit_time/text()"); lastCommitTime = parser.getDate("response/result/contributor_fact/last_commit_time/text()"); manMonths = parser.getInt("response/result/contributor_fact/man_months/text()"); commits = parser.getInt("response/result/contributor_fact/commits/text()"); medianCommits = parser.getInt("response/result/contributor_fact/median_commits/text()"); contributorLanguageFact = createContLangFact( parser.getNodeList( "response/result/contributor_fact/contributor_language_facts/contributor_language_fact")); }