Examples of HtmlCleaner


Examples of org.htmlcleaner.HtmlCleaner

    {
      for( int i=0 ; i<lElements.size() ; i++ )
      {
        try
        {
          HtmlCleaner cleaner = new HtmlCleaner();
          TagNode rootNode = cleaner.clean(new URL(url));
          TagNode tagElements[] = rootNode.getElementsByName( lElements.get(i).getTag(), true );
          for( int j=0 ; j<tagElements.length ; j++ )
            if( lElements.get(i).getClas().equalsIgnoreCase("*") || tagElements[j].getAttributeByName("class").equals(lElements.get(i).getClas()) )
              lElements.get(i).add( tagElements[j].getText().toString() );
        }
View Full Code Here

Examples of org.htmlcleaner.HtmlCleaner

  public synchronized StringBuffer format(StringBuffer sb)
  {
    StringBuffer sbResult = new StringBuffer();
    try
    {
      HtmlCleaner cleaner = new HtmlCleaner();
     
      CleanerProperties props = cleaner.getProperties();
      props.setUseEmptyElementTags(false);
     
      TagNode node = cleaner.clean(sb.toString());
      Document myJDom = new JDomSerializer(props, true).createJDom(node);
      XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
      sbResult.append(outputter.outputString(myJDom));
    }
    catch (IOException e) {logger.error(e);}
View Full Code Here

Examples of org.htmlcleaner.HtmlCleaner

  public HtmlUtils(String html) {
    this.html = html;

    // create an instance of HtmlCleaner
    cleaner = new HtmlCleaner();
    // take default cleaner properties
    CleanerProperties props = cleaner.getProperties();

    // customize cleaner's behaviour with property setters
    // props.setXXX(...);
View Full Code Here

Examples of org.htmlcleaner.HtmlCleaner

 
  public HtmlUtils(URL url) throws IOException {
    this.url = url;

    // create an instance of HtmlCleaner
    cleaner = new HtmlCleaner();
    // take default cleaner properties
    CleanerProperties props = cleaner.getProperties();

    // customize cleaner's behaviour with property setters
    // props.setXXX(...);
View Full Code Here

Examples of org.htmlcleaner.HtmlCleaner

  public static void printTagNodes( Object[] nodes) throws Exception
  {
    // serialize a node to a file, output stream, DOM, JDom...
    System.out.println( "\n\n\nINICIO");

    HtmlCleaner cleaner = new HtmlCleaner();
    CleanerProperties props = cleaner.getProperties();
    PrettyXmlSerializer serializer = new PrettyXmlSerializer( props);
 
    for( int i=0 ; i<nodes.length ; i++) {
      System.out.println( "######################## Va uno " + i);
View Full Code Here

Examples of org.htmlcleaner.HtmlCleaner

  public static void main(String[] args) throws Exception
  {
      Translator.load( "es");
     
      // create an instance of HtmlCleaner
    HtmlCleaner cleaner = new HtmlCleaner();

    // take default cleaner properties
    CleanerProperties props = cleaner.getProperties();

    // customize cleaner's behaviour with property setters
//    props.setXXX(...);

    // Clean HTML taken from simple string, file, URL, input stream,
    // input source or reader. Result is root node of created
    // tree-like structure. Single cleaner instance may be safely used
    // multiple times.
//    TagNode node = cleaner.clean( new File("tests/accept.html"));

    TagNode node = cleaner.clean( new File("tests/rallypoint.htm"));


    Object[] myNodes;
       
View Full Code Here

Examples of org.htmlcleaner.HtmlCleaner

  public static void main(String[] args) throws Exception
  {
      Translator.load( "es");
     
      // create an instance of HtmlCleaner
    HtmlCleaner cleaner = new HtmlCleaner();

    // take default cleaner properties
    CleanerProperties props = cleaner.getProperties();

    // customize cleaner's behaviour with property setters
//    props.setXXX(...);

    // Clean HTML taken from simple string, file, URL, input stream,
    // input source or reader. Result is root node of created
    // tree-like structure. Single cleaner instance may be safely used
    // multiple times.
//    TagNode node = cleaner.clean( new File("tests/accept.html"));

    TagNode node = cleaner.clean( new File("tests/materias.html"));

    Village village = new Village();
        IOVillage.updateVillageOverview( village);
        System.out.println( village);
View Full Code Here

Examples of org.htmlcleaner.HtmlCleaner

    public static void updatePlayers( Ally ally) throws Exception
    {
        // 1. get ally
      String page = HttpServer.getHttpServer().httpGetPage( "http://s3.travian.net/allianz.php?aid=" + ally.getId());
       
        HtmlCleaner cleaner = new HtmlCleaner();
        CleanerProperties props = cleaner.getProperties();
        props.setRecognizeUnicodeChars( true);
//        TagNode node = cleaner.clean( new File("tests/ally.html"));
        TagNode node = cleaner.clean( page);

        updatePlayers( ally, node);
      
    }
View Full Code Here

Examples of org.htmlcleaner.HtmlCleaner

public class IOVillage
{
  public static void updateVillageOverview( Village village) throws Exception
  {
    HtmlCleaner cleaner = new HtmlCleaner();
//    CleanerProperties props = cleaner.getProperties();
//    props.setRecognizeUnicodeChars( true);
    TagNode node = cleaner.clean( new File("tests/overview3.html"));

    updateTerrains(village, node);
    updateStorage( village, node);
    updateProductionRate( village, node);
    updateServerTimestamp( village, node);
View Full Code Here

Examples of org.htmlcleaner.HtmlCleaner

    {
        // 1. get overview/innerview pantalla actual
      String page = HttpServer.getHttpServer().httpGetPage( "http://s3.travian.net/spieler.php?uid=" + player.getId());
      Thread.sleep( (long) (1000 + 3000*Math.random()));

        HtmlCleaner cleaner = new HtmlCleaner();
        CleanerProperties props = cleaner.getProperties();
        props.setRecognizeUnicodeChars( true);
//        TagNode node = cleaner.clean( new File("tests/perfil.html"));
        TagNode node = cleaner.clean( page);

        updateMapVillages2( player, node);

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.