Skip to content

Commit 67301b8

Browse files
committed
better document tag name casing
1 parent 4d0723a commit 67301b8

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,19 @@ parser.setProperty(HTMLScanner.ERROR_REPORTER, errorReporter);
261261
parser.setProperty(HTMLScanner.READER_BUFFER_SIZE, 2048);
262262
```
263263

264+
### Tag Case Handling
265+
266+
By default, tags inserted by the parser to fix the DOM tree are created in **lowercase** to maintain XHTML compatibility.
267+
For example, when the parser automatically inserts missing elements like `<html>`, `<head>`, or `<body>`, these tags will be in lowercase form.
268+
269+
However, you can control the case of element names using the property:
270+
```java
271+
parser.setProperty("http://cyberneko.org/html/properties/names/elems", "upper");
272+
```
273+
274+
When this property is set to `"upper"`, the parser will create all tag names in **uppercase** instead.
275+
This includes both tags present in the source HTML and tags automatically inserted to balance the DOM tree.
276+
264277
#### Important Notes
265278

266279
- **Encoding Translator**: The `StandardEncodingTranslator` provides WHATWG-compliant encoding name mapping. Use `EncodingMap` only if you need legacy behavior compatibility.

0 commit comments

Comments
 (0)