| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.serialize; |
| 9 |
|
| 10 |
import net.sf.saxon.lib.NamespaceConstant; |
| 11 |
import net.sf.saxon.om.NodeName; |
| 12 |
|
| 13 |
import java.util.Collections; |
| 14 |
import java.util.HashSet; |
| 15 |
import java.util.Set; |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
public class XHTML1Emitter extends XMLEmitter { |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
static Set<String> emptyTags1 = new HashSet<String>(31); |
| 32 |
|
| 33 |
private static String[] emptyTagNames1 = { |
| 34 |
"area", "base", "basefont", "br", "col", "embed", "frame", "hr", "img", "input", "isindex", "link", "meta", "param" |
| 35 |
|
| 36 |
}; |
| 37 |
|
| 38 |
|
| 39 |
static { |
| 40 |
Collections.addAll(emptyTags1, emptyTagNames1); |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
private boolean isRecognizedHtmlElement(NodeName name) { |
| 45 |
return name.hasURI(NamespaceConstant.XHTML); |
| 46 |
|
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
protected String emptyElementTagCloser(String displayName, NodeName name) { |
| 54 |
if (isRecognizedHtmlElement(name) && emptyTags1.contains(name.getLocalPart())) { |
| 55 |
return " />"; |
| 56 |
} else { |
| 57 |
return "></" + displayName + '>'; |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
} |
| 63 |
|