public static ContributorFact createContributorFact(HttpResponse res) { if (null == res) { return null; } XMLParser parser = new XMLParser(res.asString()); ContributorFact contributorFact = new ContributorFactImpl(parser, false); return contributorFact; }
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; }