| 29 * @param def the default value when the attribute is empty |
29 * @param def the default value when the attribute is empty |
| 30 * @return the attribute value or the default |
30 * @return the attribute value or the default |
| 31 */ |
31 */ |
| 32 public static String getAttrOrDefault(Element elm, String attr, String def) { |
32 public static String getAttrOrDefault(Element elm, String attr, String def) { |
| 33 final var v = elm.getAttribute(attr); |
33 final var v = elm.getAttribute(attr); |
| 34 return v.isBlank() ? def : v; |
34 return v.isBlank() ? def : v.trim(); |
| 35 } |
35 } |
| 36 |
36 |
| 37 /** |
37 /** |
| 38 * Returns the text content of the given element with indentation automatically trimmed. |
38 * Returns the text content of the given element with indentation automatically trimmed. |
| 39 * |
39 * |