Skip to content

Commit dc10ae9

Browse files
Deprecate HTML4-error-reporting methods/classes
This change deprecates all public methods related to reporting of HTML4-specific parse errors — as well as deprecating the entire nu.validator.htmlparser.common.DoctypeExpectation class, which is only used when reporting HTML4-specific parse errors. Compare to 5c8fe7a
1 parent 8010453 commit dc10ae9

File tree

10 files changed

+38
-3
lines changed

10 files changed

+38
-3
lines changed

src/nu/validator/htmlparser/common/DoctypeExpectation.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* @version $Id$
2929
* @author hsivonen
3030
*/
31+
@Deprecated
3132
public enum DoctypeExpectation {
3233
/**
3334
* Be a pure HTML5 parser.

src/nu/validator/htmlparser/common/DocumentModeHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ public interface DocumentModeHandler {
3939
* @param mode the document mode
4040
* @param publicIdentifier the public id of the doctype or <code>null</code> if unavailable
4141
* @param systemIdentifier the system id of the doctype or <code>null</code> if unavailable
42-
* @param html4SpecificAdditionalErrorChecks <code>true</code> if HTML 4-specific checks were enabled, <code>false</code> otherwise
4342
* @throws SAXException if things go wrong
4443
*/
44+
public void documentMode(DocumentMode mode, String publicIdentifier, String systemIdentifier) throws SAXException;
45+
46+
@Deprecated
4547
public void documentMode(DocumentMode mode, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) throws SAXException;
4648
}

src/nu/validator/htmlparser/dom/DOMTreeBuilder.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,15 @@ protected DOMTreeBuilder(DOMImplementation implementation) {
248248
/**
249249
*
250250
* @see nu.validator.htmlparser.impl.TreeBuilder#documentMode(nu.validator.htmlparser.common.DocumentMode,
251-
* java.lang.String, java.lang.String, boolean)
251+
* java.lang.String, java.lang.String)
252252
*/
253+
protected void documentMode(DocumentMode mode, String publicIdentifier,
254+
String systemIdentifier)
255+
throws SAXException {
256+
document.setUserData("nu.validator.document-mode", mode, null);
257+
}
258+
259+
@Deprecated
253260
protected void documentMode(DocumentMode mode, String publicIdentifier,
254261
String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)
255262
throws SAXException {

src/nu/validator/htmlparser/dom/HtmlDocumentBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ public void setScriptingEnabled(boolean scriptingEnabled) {
462462
*
463463
* @return the doctypeExpectation
464464
*/
465+
@Deprecated
465466
public DoctypeExpectation getDoctypeExpectation() {
466467
return doctypeExpectation;
467468
}
@@ -473,6 +474,7 @@ public DoctypeExpectation getDoctypeExpectation() {
473474
* the doctypeExpectation to set
474475
* @see nu.validator.htmlparser.impl.TreeBuilder#setDoctypeExpectation(nu.validator.htmlparser.common.DoctypeExpectation)
475476
*/
477+
@Deprecated
476478
public void setDoctypeExpectation(DoctypeExpectation doctypeExpectation) {
477479
this.doctypeExpectation = doctypeExpectation;
478480
if (treeBuilder != null) {
@@ -526,6 +528,7 @@ public void setStreamabilityViolationPolicy(
526528
* the name in the value.
527529
* @param html4ModeCompatibleWithXhtml1Schemata
528530
*/
531+
@Deprecated
529532
public void setHtml4ModeCompatibleWithXhtml1Schemata(
530533
boolean html4ModeCompatibleWithXhtml1Schemata) {
531534
this.html4ModeCompatibleWithXhtml1Schemata = html4ModeCompatibleWithXhtml1Schemata;
@@ -548,6 +551,7 @@ public Locator getDocumentLocator() {
548551
*
549552
* @return the html4ModeCompatibleWithXhtml1Schemata
550553
*/
554+
@Deprecated
551555
public boolean isHtml4ModeCompatibleWithXhtml1Schemata() {
552556
return html4ModeCompatibleWithXhtml1Schemata;
553557
}

src/nu/validator/htmlparser/impl/Tokenizer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ public void setNamePolicy(XmlViolationPolicy namePolicy) {
748748
* @param html4ModeCompatibleWithXhtml1Schemata
749749
* the html4ModeCompatibleWithXhtml1Schemata to set
750750
*/
751+
@Deprecated
751752
public void setHtml4ModeCompatibleWithXhtml1Schemata(
752753
boolean html4ModeCompatibleWithXhtml1Schemata) {
753754
this.html4ModeCompatibleWithXhtml1Schemata = html4ModeCompatibleWithXhtml1Schemata;

src/nu/validator/htmlparser/impl/TreeBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6027,6 +6027,7 @@ public void setIsSrcdocDocument(boolean isSrcdocDocument) {
60276027
* @param doctypeExpectation
60286028
* the doctypeExpectation to set
60296029
*/
6030+
@Deprecated
60306031
public void setDoctypeExpectation(DoctypeExpectation doctypeExpectation) {
60316032
this.doctypeExpectation = doctypeExpectation;
60326033
}

src/nu/validator/htmlparser/io/Driver.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ public void setTransitionHandler(TransitionHandler transitionHandler) {
558558
* @param html4ModeCompatibleWithXhtml1Schemata
559559
* @see nu.validator.htmlparser.impl.Tokenizer#setHtml4ModeCompatibleWithXhtml1Schemata(boolean)
560560
*/
561+
@Deprecated
561562
public void setHtml4ModeCompatibleWithXhtml1Schemata(
562563
boolean html4ModeCompatibleWithXhtml1Schemata) {
563564
tokenizer.setHtml4ModeCompatibleWithXhtml1Schemata(html4ModeCompatibleWithXhtml1Schemata);

src/nu/validator/htmlparser/sax/HtmlParser.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,7 @@ public void setScriptingEnabled(boolean scriptingEnabled) {
817817
*
818818
* @return the doctypeExpectation
819819
*/
820+
@Deprecated
820821
public DoctypeExpectation getDoctypeExpectation() {
821822
return doctypeExpectation;
822823
}
@@ -828,6 +829,7 @@ public DoctypeExpectation getDoctypeExpectation() {
828829
* the doctypeExpectation to set
829830
* @see nu.validator.htmlparser.impl.TreeBuilder#setDoctypeExpectation(nu.validator.htmlparser.common.DoctypeExpectation)
830831
*/
832+
@Deprecated
831833
public void setDoctypeExpectation(DoctypeExpectation doctypeExpectation) {
832834
this.doctypeExpectation = doctypeExpectation;
833835
if (treeBuilder != null) {
@@ -881,6 +883,7 @@ public void setStreamabilityViolationPolicy(
881883
* the name in the value.
882884
* @param html4ModeCompatibleWithXhtml1Schemata
883885
*/
886+
@Deprecated
884887
public void setHtml4ModeCompatibleWithXhtml1Schemata(
885888
boolean html4ModeCompatibleWithXhtml1Schemata) {
886889
this.html4ModeCompatibleWithXhtml1Schemata = html4ModeCompatibleWithXhtml1Schemata;
@@ -903,6 +906,7 @@ public Locator getDocumentLocator() {
903906
*
904907
* @return the html4ModeCompatibleWithXhtml1Schemata
905908
*/
909+
@Deprecated
906910
public boolean isHtml4ModeCompatibleWithXhtml1Schemata() {
907911
return html4ModeCompatibleWithXhtml1Schemata;
908912
}

src/nu/validator/htmlparser/xom/HtmlBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ public void setScriptingEnabled(boolean scriptingEnabled) {
499499
*
500500
* @return the doctypeExpectation
501501
*/
502+
@Deprecated
502503
public DoctypeExpectation getDoctypeExpectation() {
503504
return doctypeExpectation;
504505
}
@@ -510,6 +511,7 @@ public DoctypeExpectation getDoctypeExpectation() {
510511
* the doctypeExpectation to set
511512
* @see nu.validator.htmlparser.impl.TreeBuilder#setDoctypeExpectation(nu.validator.htmlparser.common.DoctypeExpectation)
512513
*/
514+
@Deprecated
513515
public void setDoctypeExpectation(DoctypeExpectation doctypeExpectation) {
514516
this.doctypeExpectation = doctypeExpectation;
515517
if (treeBuilder != null) {
@@ -563,6 +565,7 @@ public void setStreamabilityViolationPolicy(
563565
* the name in the value.
564566
* @param html4ModeCompatibleWithXhtml1Schemata
565567
*/
568+
@Deprecated
566569
public void setHtml4ModeCompatibleWithXhtml1Schemata(
567570
boolean html4ModeCompatibleWithXhtml1Schemata) {
568571
this.html4ModeCompatibleWithXhtml1Schemata = html4ModeCompatibleWithXhtml1Schemata;
@@ -585,6 +588,7 @@ public Locator getDocumentLocator() {
585588
*
586589
* @return the html4ModeCompatibleWithXhtml1Schemata
587590
*/
591+
@Deprecated
588592
public boolean isHtml4ModeCompatibleWithXhtml1Schemata() {
589593
return html4ModeCompatibleWithXhtml1Schemata;
590594
}

src/nu/validator/htmlparser/xom/XOMTreeBuilder.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,19 @@ protected void start(boolean fragment) throws SAXException {
254254

255255
/**
256256
* @see nu.validator.htmlparser.impl.TreeBuilder#documentMode(nu.validator.htmlparser.common.DocumentMode,
257-
* java.lang.String, java.lang.String, boolean)
257+
* java.lang.String, java.lang.String)
258258
*/
259+
protected void documentMode(DocumentMode mode, String publicIdentifier,
260+
String systemIdentifier)
261+
throws SAXException {
262+
if (document instanceof Mode) {
263+
Mode modal = (Mode) document;
264+
modal.setMode(mode);
265+
}
266+
}
267+
259268
@Override
269+
@Deprecated
260270
protected void documentMode(DocumentMode mode, String publicIdentifier,
261271
String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)
262272
throws SAXException {

0 commit comments

Comments
 (0)