1 7 8 package org.cyberneko.html.filters; 9 10 import org.cyberneko.html.HTMLConfiguration; 11 import org.cyberneko.html.HTMLEventInfo; 12 13 import org.apache.xerces.xni.Augmentations; 14 import org.apache.xerces.xni.QName; 15 import org.apache.xerces.xni.XMLAttributes; 16 import org.apache.xerces.xni.XNIException; 17 import org.apache.xerces.xni.parser.XMLDocumentFilter; 18 import org.apache.xerces.xni.parser.XMLInputSource; 19 import org.apache.xerces.xni.parser.XMLParserConfiguration; 20 21 48 public class Identity 49 extends DefaultFilter { 50 51 55 56 protected static final String AUGMENTATIONS = "http://cyberneko.org/html/features/augmentations"; 57 58 59 protected static final String FILTERS = "http://cyberneko.org/html/properties/filters"; 60 61 65 66 public void startElement(QName element, XMLAttributes attributes, 67 Augmentations augs) throws XNIException { 68 if (augs == null || !synthesized(augs)) { 69 super.startElement(element, attributes, augs); 70 } 71 } 73 74 public void emptyElement(QName element, XMLAttributes attributes, 75 Augmentations augs) throws XNIException { 76 if (augs == null || !synthesized(augs)) { 77 super.emptyElement(element, attributes, augs); 78 } 79 } 81 82 public void endElement(QName element, Augmentations augs) 83 throws XNIException { 84 if (augs == null || !synthesized(augs)) { 85 super.endElement(element, augs); 86 } 87 } 89 93 94 protected static boolean synthesized(Augmentations augs) { 95 HTMLEventInfo info = (HTMLEventInfo)augs.getItem(AUGMENTATIONS); 96 return info != null ? info.isSynthesized() : false; 97 } 99 } | Popular Tags |