1 22 23 package org.xquark.mapper.storage; 24 25 import java.io.IOException ; 26 27 import org.xml.sax.*; 28 import org.xml.sax.ext.LexicalHandler ; 29 import org.xquark.util.SAXConstants; 30 import org.xquark.xml.xdbc.XMLDBCException; 31 32 33 37 38 public abstract class BaseXMLReaderImpl extends XMLBuilder 39 implements RepositoryReader, SAXConstants 40 { 41 private static final String RCSRevision = "$Revision: 1.1 $"; 42 private static final String RCSName = "$Name: $"; 43 47 49 protected boolean restoreEnumeratedAttrTypes = false; 59 60 public BaseXMLReaderImpl(_RepositoryCollection collection) 61 throws XMLDBCException 62 { 63 super(collection); 64 } 65 66 public void parse(InputSource input) 70 throws IOException , SAXException 71 { 72 if (input.getSystemId() != null) 73 parse(input.getSystemId()); 74 else 75 parse(input.getPublicId()); 76 } 77 78 public boolean getFeature(String name) 79 throws SAXNotRecognizedException, SAXNotSupportedException 80 { 81 if (name.equals(SAX_NAMESPACE_FEATURE)) 82 return true; 83 else if (name.equals(SAX_PREFIX_FEATURE)) 84 return false; 85 else if (name.equals(SAX_VALIDATION_FEATURE)) 86 return false; 87 else 88 throw new SAXNotSupportedException("Unrecognized feature."); 89 } 90 public Object getProperty (String name) 91 throws SAXNotRecognizedException, SAXNotSupportedException 92 { 93 if (name.equals(SAX_LEXICAL_PROPERTY)) 94 return lexicalHandler; 95 else 96 throw new SAXNotSupportedException("Unrecognized property."); 97 } 98 99 public ContentHandler getContentHandler () 100 { 101 return contentHandler; 102 } 103 104 public ErrorHandler getErrorHandler () 105 { 106 return errorHandler; 107 } 108 109 public EntityResolver getEntityResolver() 110 { 111 return null; 112 } 113 114 public DTDHandler getDTDHandler () 115 { 116 return null; 117 } 118 119 public void setContentHandler(ContentHandler handler) 120 { 121 contentHandler = handler; 122 } 123 124 public void setDTDHandler(DTDHandler handler) 125 { 126 } 128 129 public void setErrorHandler(ErrorHandler handler) 130 { 131 errorHandler = handler; 132 } 133 134 public void setEntityResolver(EntityResolver resolver) 135 { 136 } 137 138 public void setFeature(String name,boolean value) 139 throws SAXNotRecognizedException, SAXNotSupportedException 140 { 141 if (name.equals(SAX_NAMESPACE_FEATURE)) 142 { 143 if (!value) 144 throw new SAXNotSupportedException("This feature can only be set to true."); 145 else 146 return; 147 } 148 else if (name.equals(SAX_PREFIX_FEATURE)) 149 { 150 if (value) 151 throw new SAXNotSupportedException("This feature can only be set to false."); 152 else 153 return; 154 } 155 else if (name.equals(SAX_VALIDATION_FEATURE)) 156 return; 157 else 158 throw new SAXNotSupportedException("Unrecognized feature."); 159 } 160 161 public void setProperty(String name,Object value) 162 throws SAXNotRecognizedException, SAXNotSupportedException 163 { 164 if (name.equals(SAX_LEXICAL_PROPERTY)) 165 lexicalHandler = (LexicalHandler )value; 166 else 167 throw new SAXNotSupportedException("Unrecognized property."); 168 } 169 170 174 178 } | Popular Tags |