src/share/classes/com/sun/tools/doclint/Checker.java

changeset 1793
391f97e270c2
parent 1726
a7ff36d06fa2
child 1912
1e533c1bfb01
equal deleted inserted replaced
1792:ec871c3e8337 1793:391f97e270c2
529 checkURI(tree, v); 529 checkURI(tree, v);
530 } 530 }
531 } 531 }
532 } 532 }
533 break; 533 break;
534
535 case VALUE:
536 if (currTag == HtmlTag.LI) {
537 String v = getAttrValue(tree);
538 if (v == null || v.isEmpty()) {
539 env.messages.error(HTML, tree, "dc.attr.lacks.value");
540 } else if (!validNumber.matcher(v).matches()) {
541 env.messages.error(HTML, tree, "dc.attr.not.number");
542 }
543 }
544 break;
534 } 545 }
535 } 546 }
536 } 547 }
537 548
538 // TODO: basic check on value 549 // TODO: basic check on value
540 return super.visitAttribute(tree, ignore); 551 return super.visitAttribute(tree, ignore);
541 } 552 }
542 553
543 // http://www.w3.org/TR/html401/types.html#type-name 554 // http://www.w3.org/TR/html401/types.html#type-name
544 private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*"); 555 private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*");
556
557 private static final Pattern validNumber = Pattern.compile("-?[0-9]+");
545 558
546 // pattern to remove leading {@docRoot}/? 559 // pattern to remove leading {@docRoot}/?
547 private static final Pattern docRoot = Pattern.compile("(?i)(\\{@docRoot *\\}/?)?(.*)"); 560 private static final Pattern docRoot = Pattern.compile("(?i)(\\{@docRoot *\\}/?)?(.*)");
548 561
549 private String getAttrValue(AttributeTree tree) { 562 private String getAttrValue(AttributeTree tree) {

mercurial