Package com.wot.shared

Examples of com.wot.shared.XmlDescription


    //création category achievement
    XmlListCategoryAchievement myXmlListCategoryAchievement = objFactory.createXmlListCategoryAchievement();
    myXmlListCategoryAchievement.setNAME(cat1Medal);
   
    //création xlmDescrition category achievement
    XmlDescription myXmlDescription= objFactory.createXmlDescription();
    myXmlDescription.setVALUE("Desccription de la ctégorie de médailles");
    myXmlListCategoryAchievement.setDESCRIPTION(myXmlDescription);
   
    //Ajouter la catégorie achievement au wiki
    wiki.getACHIEVEMENTS().getCATEGORYACHIEVEMENT().add(myXmlListCategoryAchievement);
   
    //parse WIKI HTML
    int pos1 = AllLinesWot.indexOf(cat1Medal+"</span></div>" );
    int pos2 = -1;
    if ("printfooter".equalsIgnoreCase(cat2Medal))
      pos2 = AllLinesWot.indexOf(cat2Medal );
    else
      pos2 = AllLinesWot.indexOf(cat2Medal+"</span></div>" );
   
   
    //selon les cat�gories de m�dailles, on doit aller rechercher la 2�me pour la 1�re ocurence du nom de la cat�gorie de m�dailles
    //donc on prend toujours la derni�re
   
    if (pos1 == -1)
      pos1 = AllLinesWot.indexOf(cat1Medal+ " <i>" );
   
   
    if (pos2 == -1)
      pos2 = AllLinesWot.indexOf(cat2Medal+ " <i>" );
   
   
    System.out.println("=======>>>>>>>>>>>>>" + cat1Medal);
    if (pos1 != -1 && pos2 !=-1) {
      int posSrc = 0 ;
      while(posSrc != -1 && posSrc<pos2) {
        posSrc = AllLinesWot.indexOf("src=", pos1);
        int posSlashDiv = AllLinesWot.indexOf("</div>", posSrc); //on doit rechercher tous les src avant </div>
       
        if (posSrc != -1 && posSrc<pos2) {
         
          //on est dans les medailles en question
          String srcImgMedal = "";
          List<String> listSrcImgMedal = new ArrayList<String>();
          do {
            posSrc = AllLinesWot.indexOf("src=", pos1);
            posSrc=  posSrc+"src=".length();
            int posWidth = AllLinesWot.indexOf("width", posSrc);
            srcImgMedal = AllLinesWot.substring(posSrc+1, posWidth-2);
            listSrcImgMedal.add(srcImgMedal);
           
            pos1= posWidth;
            posSrc = AllLinesWot.indexOf("src=", pos1);
          }while(posSrc < posSlashDiv);
         
          int posDebutB = AllLinesWot.indexOf("<b>", pos1);
          int posFinB = AllLinesWot.indexOf("</b>", pos1);
         
          String titleMedal= AllLinesWot.substring(posDebutB+"<b>".length(), posFinB);
          for (String src : listSrcImgMedal) {
            System.out.println(src + "\t" + titleMedal + "\t"); //titre de la m�daille
          }
          pos1= posFinB;
         
          //la description de la m�daille se trouve entre </b> et le prochain "<"
          int posInf = AllLinesWot.indexOf("<", posFinB + "</b>".length());
          String descMedalWithB= AllLinesWot.substring(posDebutB-1 + "<".length(), posInf);
          System.out.println("\t" + descMedalWithB);
         
         
          //création d'un achievement
          XmlListAchievement myXmlListAchievement = objFactory.createXmlListAchievement();
         
          //set du nom de la médaille
          myXmlListAchievement.setNAME(titleMedal);
         
          //set description de la médaille
          //création xlmDescrition achievement
          myXmlDescription= objFactory.createXmlDescription();
          myXmlDescription.setVALUE(descMedalWithB);
          myXmlListAchievement.setDESCRIPTION(myXmlDescription);
         
          //set des src des icônes des médailles
          XmlListSrcImg myXmlListSrcImg = objFactory.createXmlListSrcImg();
         
View Full Code Here


    //création category achievement
    XmlListCategoryAchievement myXmlListCategoryAchievement = objFactory.createXmlListCategoryAchievement();
    myXmlListCategoryAchievement.setNAME(cat1Medal);
   
    //création xlmDescrition category achievement
    XmlDescription myXmlDescription= objFactory.createXmlDescription();
    myXmlDescription.setVALUE("Desccription de la ctégorie de médailles");
    myXmlListCategoryAchievement.setDESCRIPTION(myXmlDescription);
   
    //Ajouter la catégorie achievement au wiki
    wiki.getACHIEVEMENTS().getCATEGORYACHIEVEMENT().add(myXmlListCategoryAchievement);
   
    //parse WIKI HTML
    int pos1 = AllLinesWot.indexOf(cat1Medal+"</span></div>" );
    int pos2 = -1;
    if ("printfooter".equalsIgnoreCase(cat2Medal))
      pos2 = AllLinesWot.indexOf(cat2Medal );
    else
      pos2 = AllLinesWot.indexOf(cat2Medal+"</span></div>" );
   
   
    //selon les cat�gories de m�dailles, on doit aller rechercher la 2�me pour la 1�re ocurence du nom de la cat�gorie de m�dailles
    //donc on prend toujours la derni�re
   
    if (pos1 == -1)
      pos1 = AllLinesWot.indexOf(cat1Medal+ " <i>" );
   
   
    if (pos2 == -1)
      pos2 = AllLinesWot.indexOf(cat2Medal+ " <i>" );
   
   
    System.out.println("=======>>>>>>>>>>>>>" + cat1Medal);
    if (pos1 != -1 && pos2 !=-1) {
      int posSrc = 0 ;
      while(posSrc != -1 && posSrc<pos2) {
        posSrc = AllLinesWot.indexOf("src=", pos1);
        int posSlashDiv = AllLinesWot.indexOf("</div>", posSrc); //on doit rechercher tous les src avant </div>
       
        if (posSrc != -1 && posSrc<pos2) {
         
          //on est dans les medailles en question
          String srcImgMedal = "";
          List<String> listSrcImgMedal = new ArrayList<String>();
          do {
            posSrc = AllLinesWot.indexOf("src=", pos1);
            posSrc=  posSrc+"src=".length();
            int posWidth = AllLinesWot.indexOf("width", posSrc);
            srcImgMedal = AllLinesWot.substring(posSrc+1, posWidth-2);
            listSrcImgMedal.add(srcImgMedal);
           
            pos1= posWidth;
            posSrc = AllLinesWot.indexOf("src=", pos1);
          }while(posSrc < posSlashDiv);
         
          int posDebutB = AllLinesWot.indexOf("<b>", pos1);
          int posFinB = AllLinesWot.indexOf("</b>", pos1);
         
          String titleMedal= AllLinesWot.substring(posDebutB+"<b>".length(), posFinB);
          for (String src : listSrcImgMedal) {
            System.out.println(src + "\t" + titleMedal + "\t"); //titre de la m�daille
          }
          pos1= posFinB;
         
          //la description de la m�daille se trouve entre </b> et le prochain "</div"
          int posNextSlashDiv = AllLinesWot.indexOf("</div", posFinB + "</b>".length());
         
          //dans cette description, il faut supprimer un certain nombre de choses les  href,  les title les </a> s'il y en a bien sur 
          //<a href="/Jagdpanther" title="Jagdpanther">Jagdpanther</a>,
          //<b>Hunter</b> - Destroy 100 or more of the following tanks:
//              <a href="/wiki.worldoftanks.com/Jagdpanther" title="Jagdpanther">Jagdpanther</a>,
//              <a href="/wiki.worldoftanks.com/Jagdtiger" title="Jagdtiger">Jagdtiger</a>,
//              <a href="/wiki.worldoftanks.com/Pz.Kpfw._V_Panther" title="Pz.Kpfw. V Panther">Pz.Kpfw. V Panther</a>,
//              <a href="/wiki.worldoftanks.com/Panther/M10" title="Panther/M10">Panther/M10</a>,
//              <a href="/wiki.worldoftanks.com/Panther_II" title="Panther II">Panther II</a>,
//              <a href="/wiki.worldoftanks.com/Pz.Kpfw._VI_Tiger" title="Pz.Kpfw. VI Tiger">Pz.Kpfw. VI Tiger</a>,
//              <a href="/wiki.worldoftanks.com/Pz.Kpfw._VI_Tiger_(P)" title="Pz.Kpfw. VI Tiger (P)">Pz.Kpfw. VI Tiger (P)</a>,
//              <a href="/wiki.worldoftanks.com/Pz.Kpfw._Tiger_II" title="Pz.Kpfw. Tiger II">Pz.Kpfw. Tiger II</a>,
//              <a href="/wiki.worldoftanks.com/L%C3%B6we" title="Löwe">Löwe</a>,
//              <a href="/wiki.worldoftanks.com/GW_Panther" title="GW Panther" class="mw-redirect">GW Panther</a>,
//              <a href="/wiki.worldoftanks.com/GW_Tiger" title="GW Tiger" class="mw-redirect">GW Tiger</a>,
//              <a href="/wiki.worldoftanks.com/Jagdpanther_II" title="Jagdpanther II">Jagdpanther II</a> and
//              <a href="/wiki.worldoftanks.com/8,8_cm_PaK_43_Jagdtiger" title="8,8 cm PaK 43 Jagdtiger">8,8 cm PaK 43 Jagdtiger</a>
             
          String finalDescMedal = "";
          String descMedalWithB= AllLinesWot.substring(posDebutB-1 + "<".length(), posNextSlashDiv);
//          while (descMedalWithB.contains("<a")) {
//           
//            //ci dessous une seule fois
//            if (finalDescMedal.equalsIgnoreCase("")) {
//              int posInfA = descMedalWithB.indexOf("<a");
//              finalDescMedal = descMedalWithB.substring(posFinB + "</b>".length()+ " - ".length(), posInfA); //recup toute la description avant <a
//            }
//           
//            //boucle
//            int posSlashA = descMedalWithB.indexOf("</a>");
//            int posSupHref = descMedalWithB.indexOf(">");
//            String partDesc = descMedalWithB.substring(posSupHref+1, posSlashA);
//            finalDescMedal = finalDescMedal + " " + partDesc;
//         
//            //on supprime le début de la description jusqu'au </a>
//            descMedalWithB = descMedalWithB.substring(posSlashA+"</a>".length());
//           
//          }
          if (finalDescMedal.equalsIgnoreCase("")) {
            finalDescMedal = descMedalWithB; //recup toute la description avant <a
          }
          ///replace /wiki
          finalDescMedal = finalDescMedal.replaceAll("/wiki.", "http://wiki.");
          System.out.println("\t" + descMedalWithB);
         
          //création d'un achievement
          XmlListAchievement myXmlListAchievement = objFactory.createXmlListAchievement();
         
          //set du nom de la médaille
          myXmlListAchievement.setNAME(titleMedal);
         
          //set description de la médaille
          //création xlmDescrition achievement
          myXmlDescription= objFactory.createXmlDescription();
          myXmlDescription.setVALUE(finalDescMedal);
          myXmlListAchievement.setDESCRIPTION(myXmlDescription);
         
          //set des src des icônes des médailles
          XmlListSrcImg myXmlListSrcImg = objFactory.createXmlListSrcImg();
         
View Full Code Here

    //création category achievement
    XmlListCategoryAchievement myXmlListCategoryAchievement = objFactory.createXmlListCategoryAchievement();
    myXmlListCategoryAchievement.setNAME(cat1Medal);
   
    //création xlmDescrition category achievement
    XmlDescription myXmlDescription= objFactory.createXmlDescription();
    myXmlDescription.setVALUE("Desccription de la ctégorie de médailles");
    myXmlListCategoryAchievement.setDESCRIPTION(myXmlDescription);
   
    //Ajouter la catégorie achievement au wiki
    wiki.getACHIEVEMENTS().getCATEGORYACHIEVEMENT().add(myXmlListCategoryAchievement);
   
    //parse WIKI HTML
    int pos1 = AllLinesWot.indexOf(cat1Medal+"</span></div>" );
    int pos2 = -1;
    if ("printfooter".equalsIgnoreCase(cat2Medal))
      pos2 = AllLinesWot.indexOf(cat2Medal );
    else
      pos2 = AllLinesWot.indexOf(cat2Medal+"</span></div>" );
   
   
    //selon les cat�gories de m�dailles, on doit aller rechercher la 2�me pour la 1�re ocurence du nom de la cat�gorie de m�dailles
    //donc on prend toujours la derni�re
   
    if (pos1 == -1)
      pos1 = AllLinesWot.indexOf(cat1Medal+ " <i>" );
   
   
    if (pos2 == -1)
      pos2 = AllLinesWot.indexOf(cat2Medal+ " <i>" );
   
   
    System.out.println("=======>>>>>>>>>>>>>" + cat1Medal);
    if (pos1 != -1 && pos2 !=-1) {
      int posSrc = 0 ;
      while(posSrc != -1 && posSrc<pos2) {
        posSrc = AllLinesWot.indexOf("src=", pos1);
        int posSlashDiv = AllLinesWot.indexOf("</div>", posSrc); //on doit rechercher tous les src avant </div>
       
        if (posSrc != -1 && posSrc<pos2) {
         
          //on est dans les medailles en question
          String srcImgMedal = "";
          List<String> listSrcImgMedal = new ArrayList<String>();
          do {
            posSrc = AllLinesWot.indexOf("src=", pos1);
            posSrc=  posSrc+"src=".length();
            int posWidth = AllLinesWot.indexOf("width", posSrc);
            srcImgMedal = AllLinesWot.substring(posSrc+1, posWidth-2);
            listSrcImgMedal.add(srcImgMedal);
           
            pos1= posWidth;
            posSrc = AllLinesWot.indexOf("src=", pos1);
          }while(posSrc < posSlashDiv);
         
          int posDebutB = AllLinesWot.indexOf("<b>", pos1);
          int posFinB = AllLinesWot.indexOf("</b>", pos1);
         
          String titleMedal= AllLinesWot.substring(posDebutB+"<b>".length(), posFinB);
          for (String src : listSrcImgMedal) {
            System.out.println(src + "\t" + titleMedal + "\t"); //titre de la m�daille
          }
          pos1= posFinB;
         
          //la description de la m�daille se trouve entre </b> et le prochain "<"
          int posInf = AllLinesWot.indexOf("<", posFinB + "</b>".length());
          String descMedalWithB= AllLinesWot.substring(posDebutB-1 + "<".length(), posInf);
          System.out.println("\t" + descMedalWithB);
         
         
          //création d'un achievement
          XmlListAchievement myXmlListAchievement = objFactory.createXmlListAchievement();
         
          //set du nom de la médaille
          myXmlListAchievement.setNAME(titleMedal);
         
          //set description de la médaille
          //création xlmDescrition achievement
          myXmlDescription= objFactory.createXmlDescription();
          myXmlDescription.setVALUE(descMedalWithB);
          myXmlListAchievement.setDESCRIPTION(myXmlDescription);
         
          //set des src des icônes des médailles
          XmlListSrcImg myXmlListSrcImg = objFactory.createXmlListSrcImg();
         
View Full Code Here

TOP

Related Classes of com.wot.shared.XmlDescription

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.