Commit 81b642a84276487cacbf7ee3b1ec79befe1f6b29

Authored by gibran
1 parent 3d61e300

Correções feitas para avisos da tag <br>

src/main/java/br/com/checker/emag/core/MarkEvaluation.java
... ... @@ -27,7 +27,7 @@ public class MarkEvaluation extends Evaluation {
27 27 // private static String CSS_VALIDATOR_URL =
28 28 // "http://www.css-validator.org/validator?uri=#{url}&warning=0&output=soap12";
29 29 private static String CSS_VALIDATOR_URL = "http://jigsaw.w3.org/css-validator/validator?uri=#{url}&warning=0&output=soap12";
30   - private static String HTML_VALIDATOR_URL = "https://validator.w3.org/nu/?doc=#{url}&out=json";
  30 + private static String HTML_VALIDATOR_URL = "https://validator.w3.org/check?uri=#{url}&output=json";
31 31  
32 32 private MarkEvaluation(Source document) {
33 33 super(document);
... ... @@ -217,22 +217,20 @@ public class MarkEvaluation extends Evaluation {
217 217 }
218 218 }
219 219  
220   - for (Element element : getDocument().getAllElements("script")) {
221   -
222   -
223   - if (element != null )
224   - {
225   -
226   - if (!element.getContent().getTextExtractor().toString().trim().equalsIgnoreCase("")) {
  220 + for (Element element : getDocument().getAllElements("script")) {
  221 +
  222 + if (element != null) {
  223 +
  224 + if (!element.getContent().getTextExtractor().toString().trim()
  225 + .equalsIgnoreCase("")) {
227 226 occurrences.add(this.buildOccurrence("1.1", false,
228 227 element.toString(), element, "6"));
229   -
  228 +
230 229 }
231   -
232   -
  230 +
233 231 }
234 232 }
235   -
  233 +
236 234 this.oder(occurrences);
237 235  
238 236 return occurrences;
... ... @@ -273,6 +271,7 @@ public class MarkEvaluation extends Evaluation {
273 271 linhasImg.add(this.getRow(img));
274 272 }
275 273 } else {
  274 +
276 275 if (element.getContent().toString().isEmpty()
277 276 || element.getContent().toString().trim()
278 277 .equals("")) {
... ... @@ -283,7 +282,6 @@ public class MarkEvaluation extends Evaluation {
283 282 }
284 283 }
285 284 }
286   -
287 285 }
288 286  
289 287 linhasImg = new ArrayList<Integer>();
... ... @@ -314,15 +312,17 @@ public class MarkEvaluation extends Evaluation {
314 312 linhasImg.add(this.getRow(img));
315 313 }
316 314  
317   - } else {
318   - if (element.getContent().toString().isEmpty()
319   - || element.getContent().toString().trim()
320   - .equals("")) {
321   - occurrences.add(this.buildOccurrence("1.2", false,
322   - element.getStartTag().toString() + endTag,
323   - element, "1"));
324   - }
  315 + } else {
  316 + if (!element.getStartTag().toString().replace(" ", "").equalsIgnoreCase("<br>") && !element.getStartTag().toString().replace(" ", "").equalsIgnoreCase("</br>")) {
325 317  
  318 + if (element.getContent().toString().isEmpty()
  319 + || element.getContent().toString().trim()
  320 + .equals("")) {
  321 + occurrences.add(this.buildOccurrence("1.2",
  322 + false, element.getStartTag().toString()
  323 + + endTag, element, "1"));
  324 + }
  325 + }
326 326 }
327 327 }
328 328 }
... ... @@ -352,14 +352,15 @@ public class MarkEvaluation extends Evaluation {
352 352  
353 353 // CRITERIO 4
354 354 List<Occurrence> occurrences = new ArrayList<Occurrence>();
355   - int count = 0;
356 355  
357   - for (Element element : getDocument().getAllElements("h1")) {
358   - if (count > 0) {
  356 + int count = getDocument().getAllElements("h1").size();
  357 +
  358 + if (count > 1) {
  359 + for (Element element : getDocument().getAllElements("h1")) {
  360 +
359 361 occurrences.add(this.buildOccurrence("1.3", true,
360 362 element.toString(), element, "4"));
361   - } else
362   - count++;
  363 + }
363 364 }
364 365  
365 366 /*
... ... @@ -748,17 +749,17 @@ public class MarkEvaluation extends Evaluation {
748 749 boolean existeAncora = false;
749 750 String href = link.getAttributeValue("href");
750 751 String ancora = href.substring(1, href.length());
751   -
752   - for (Element a : getDocument().getAllElements()) {
753   - if (a.getAttributeValue("id") != null
754   - && a.getAttributeValue("id").equals(ancora)) {
755   - existeAncora = true;
756   - }
757   - if (a.getAttributeValue("name") != null
758   - && a.getAttributeValue("name").equals(ancora)) {
759   - existeAncora = true;
760   - }
761   - }
  752 +
  753 + for (Element a : getDocument().getAllElements()) {
  754 + if (a.getAttributeValue("id") != null
  755 + && a.getAttributeValue("id").equals(ancora)) {
  756 + existeAncora = true;
  757 + }
  758 + if (a.getAttributeValue("name") != null
  759 + && a.getAttributeValue("name").equals(ancora)) {
  760 + existeAncora = true;
  761 + }
  762 + }
762 763  
763 764 return existeAncora;
764 765 }
... ... @@ -861,7 +862,7 @@ public class MarkEvaluation extends Evaluation {
861 862 List<Occurrence> occurrences = new ArrayList<Occurrence>();
862 863 Element firstElement = this.getDocument().getFirstElement();
863 864  
864   - if (firstElement.toString().equals("<!DOCTYPE html>")) {
  865 + if (firstElement.toString().replace(" ", "").equals("<!DOCTYPEhtml>")) {
865 866  
866 867 Element header = getDocument().getFirstElement("header");
867 868 Element nav = getDocument().getFirstElement("nav");
... ...