Пример #1
0
 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;
 }
Пример #2
0
 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;
 }