Menu

remove surplus TD

Help
2008-09-15
2013-04-27
  • BubikolRamios

    BubikolRamios - 2008-09-15

    here:
    http://ec.europa.eu/food/plant/propagation/catalogues/comcat_agri_2008/8.html

    as you can se there is one td to the right which makes no sence, any idea how to remove it/ignore fifth column before:

    tnf.setName("TD");
    nl = parser.parse(tnf);

    ?
         

     
    • BubikolRamios

      BubikolRamios - 2008-09-15

      ok if I go like this(ie for each TD look for parent --> TR and look for its children count, if that > 6 , then this is it, remove appropriate one from nl):

            for(int i = 0; i < nl.size(); i++)
            {
              NodeList nltest = nl.elementAt(i).getParent().getChildren();
              if (nltest.size() > 6)
              {
                nl.elementAt(i).getParent().getChildren().remove(5); 
              } 
            }

      now there is no error, shouldn't the nl.size()  be now changed, it remains 29 , same as before remove.

      ?

       
    • BubikolRamios

      BubikolRamios - 2008-09-16

      my bad, correction, now it works:

            for(int i = 0; i < nl.size(); i++)
            {
              NodeList nltest = nl.elementAt(i).getParent().getChildren();
              if (nltest.size() > 6)
              {
                nl.remove(nltest.elementAt(5)); 
              } 
            }

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.