1 package org.mr.core.util.xml.sax; 2 3 import org.xml.sax.Attributes ; 4 import org.xml.sax.ContentHandler ; 5 import org.xml.sax.Locator ; 6 import org.xml.sax.SAXException ; 7 import org.xml.sax.helpers.AttributesImpl ; 8 9 54 55 64 public class NonNSContentHandler{ 65 66 private ContentHandler m_handler; 67 public final static Attributes EMPTY_ATTRIBUTES = new AttributesImpl (); 68 public static final String EMPTY_NS = ""; 69 70 public NonNSContentHandler(ContentHandler i_handler) { 71 m_handler = i_handler; 72 } 73 74 78 public ContentHandler getHandler() { 79 return m_handler; 80 } 81 82 public void setDocumentLocator(Locator i_locator) { 83 m_handler.setDocumentLocator(i_locator); 84 } 85 86 public void startDocument() 87 throws SAXException { 88 m_handler.startDocument(); 89 } 90 91 public void endDocument() 92 throws SAXException { 93 m_handler.endDocument(); 94 } 95 96 public void startElement(String i_name, NonNSAttributes i_attributes) 97 throws SAXException { 98 m_handler.startElement(EMPTY_NS, i_name, i_name, i_attributes.toAttributes()); 99 } 100 101 public void startElement(String i_name) 102 throws SAXException { 103 m_handler.startElement(EMPTY_NS, i_name, i_name, EMPTY_ATTRIBUTES); 104 } 105 106 public void endElement(String i_name) 107 throws SAXException { 108 m_handler.endElement(EMPTY_NS, i_name, i_name); 109 } 110 111 public void characters(char i_chars[], int i_startIndex, int i_length) 112 throws SAXException { 113 m_handler.characters(i_chars, i_startIndex, i_length); 114 } 115 116 public void characters(String i_str) 117 throws SAXException { 118 m_handler.characters(i_str.toCharArray(), 0, i_str.length()); 119 } 120 121 public void ignorableWhitespace(char i_chars[], int i_startIndex, int i_length) 122 throws SAXException { 123 m_handler.ignorableWhitespace(i_chars, i_startIndex, i_length); 124 } 125 126 public void processingInstruction(String i_target, String i_data) 127 throws SAXException { 128 m_handler.processingInstruction(i_target, i_data); 129 } 130 131 public void skippedEntity(String i_name) 132 throws SAXException { 133 m_handler.skippedEntity(i_name); 134 } 135 } 136 | Popular Tags |