total+=Math.max( ta.text.length(), tb.text.length() );
total+=Math.max(Math.max( ta.text.length(), tb.text.length() ),1);
    public MisCorrelation correlate( ONode a, ONode b ) {      if( ( a instanceof TextNode && b instanceof ElementNode ) ||          ( b instanceof TextNode && a instanceof ElementNode ) ) {          total=1;          mismatched=1; // Totallly different          return this;      }      if( a instanceof TextNode ) {        TextNode ta = (TextNode) a,tb=(TextNode) b;        total+=Math.max( ta.text.length(), tb.text.length() );        mismatched += stringDistance( ta.text, tb.text );      } else {        // Assume elementNode        ElementNode ea = (ElementNode) a,eb=(ElementNode) b;        total+=1;        mismatched += ea.name.equals(eb.name) ? 0 : 1; // Tag is 2 bytes of info        for( Iterator i=ea.attributes.keySet().iterator();i.hasNext();) {          String aname = (String) i.next();          if( eb.attributes.containsKey(aname) ) {            String v1 = (String) ea.attributes.get(aname), v2 = (String)  eb.attributes.get(aname);            int maxvallen =  v1.length() > v2.length() ? v1.length() : v2.length();            if( maxvallen > 5 ) {              total+=maxvallen-5;              int strdist = stringDistance(v1,v2);              mismatched += strdist > maxvallen -5 ? maxvallen : strdist;            } else {              mismatched += v1.equals(v2) ? 0 : 2;              total+=2;            }          } else {            total += 2; // A missing attribute costs 2 bytes            mismatched +=2;          }        }        // Penalties for missing attributes in ea        for( Iterator i=eb.attributes.keySet().iterator();i.hasNext();) {          String aname = (String) i.next();          if( !ea.attributes.containsKey(aname) ) {              mismatched += 2;              total+=2;           }        }      } // Elementnode      return this;    }