Refine search
/** * This implementation throws a {@code SAXNotRecognizedException} exception * for any feature outside of the "http://xml.org/sax/features/" namespace * and accepts a {@code false} value for any feature within. */ @Override public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.startsWith("http://xml.org/sax/features/")) { if (value) { throw new SAXNotSupportedException(name); } } else { throw new SAXNotRecognizedException(name); } }
/** * Set the locale for error reporting. * * <p>This is not supported in SAX2, and will always throw * an exception.</p> * * @param locale the locale for error reporting. * @see org.xml.sax.Parser#setLocale * @exception org.xml.sax.SAXException Thrown unless overridden. */ public void setLocale (Locale locale) throws SAXException { throw new SAXNotSupportedException("setLocale not supported"); }
public void parse(InputSource input) throws IOException, SAXException { try { reader.parse(input); } catch(SAXNotSupportedException e) { String message = e.getMessage(); if(message != null && message.contains("namespace-prefix")) { reader.setFeature(NAMESPACE_PREFIXES_FEATURE, false); reader.parse(input); } else { throw e; } } }
private Element getCurrentElement() { try { return (Element) getProperty( CURRENT_ELEMENT_NODE ); } catch (SAXNotRecognizedException e) { throw new RuntimeException( CURRENT_ELEMENT_NODE + " property not recognized" ); } catch (SAXNotSupportedException e) { e.printStackTrace(); throw new RuntimeException( CURRENT_ELEMENT_NODE + " property not supported" ); } }
/** * Throw an exception if we are parsing. * * <p>Use this method to detect illegal feature or * property changes.</p> * * @param type The type of thing (feature or property). * @param name The feature or property name. * @exception SAXNotSupportedException If a * document is currently being parsed. */ private void checkNotParsing (String type, String name) throws SAXNotSupportedException { if (parsing) { throw new SAXNotSupportedException("Cannot change " + type + ' ' + name + " while parsing"); } }
public void parse (String systemId) throws IOException, SAXException { try { reader.parse(systemId); } catch(SAXNotSupportedException e) { String message = e.getMessage(); if(message != null && message.contains("namespace-prefix")) { reader.setFeature(NAMESPACE_PREFIXES_FEATURE, false); reader.parse(systemId); } else { throw e; } } }
private Element getCurrentElement() { try { return (Element) getProperty( CURRENT_ELEMENT_NODE ); } catch (SAXNotRecognizedException e) { throw new RuntimeException( CURRENT_ELEMENT_NODE + " property not recognized" ); } catch (SAXNotSupportedException e) { e.printStackTrace(); throw new RuntimeException( CURRENT_ELEMENT_NODE + " property not supported" ); } }
/** * This implementation throws a {@code SAXNotRecognizedException} exception * for any feature outside of the "http://xml.org/sax/features/" namespace * and accepts a {@code false} value for any feature within. */ @Override public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.startsWith("http://xml.org/sax/features/")) { if (value) { throw new SAXNotSupportedException(name); } } else { throw new SAXNotRecognizedException(name); } }
@Override public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (NAMESPACES_FEATURE_NAME.equals(name)) { return this.namespacesFeature; } else if (NAMESPACE_PREFIXES_FEATURE_NAME.equals(name)) { return this.namespacePrefixesFeature; } else if (IS_STANDALONE_FEATURE_NAME.equals(name)) { if (this.isStandalone != null) { return this.isStandalone; } else { throw new SAXNotSupportedException("startDocument() callback not completed yet"); } } else { return super.getFeature(name); } }
public void parse (String systemId) throws IOException, SAXException { try { reader.parse(systemId); } catch(SAXNotSupportedException e) { String message = e.getMessage(); if(message != null && message.contains("namespace-prefix")) { reader.setFeature(NAMESPACE_PREFIXES_FEATURE, false); reader.parse(systemId); } else { throw e; } } }
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException("name == null"); } if (name.equals(LEXICAL_HANDLER_PROPERTY)) { // The object must implement LexicalHandler if (value instanceof LexicalHandler || value == null) { this.lexicalHandler = (LexicalHandler) value; return; } throw new SAXNotSupportedException("value doesn't implement " + "org.xml.sax.ext.LexicalHandler"); } throw new SAXNotRecognizedException(name); }
public void setProperty (String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { // if(DECLARATION_HANDLER_PROPERTY.equals(name)) { throw new SAXNotSupportedException("not supported setting property "+name);//+" to "+value); } else if(LEXICAL_HANDLER_PROPERTY.equals(name)) { throw new SAXNotSupportedException("not supported setting property "+name);//+" to "+value); } else { try { pp.setProperty(name, value); } catch(XmlPullParserException ex) { throw new SAXNotSupportedException("not supported set property "+name+": "+ ex); } //throw new SAXNotRecognizedException("not recognized set property "+name); } }
public void parse(InputSource input) throws IOException, SAXException { try { reader.parse(input); } catch(SAXNotSupportedException e) { String message = e.getMessage(); if(message != null && message.contains("namespace-prefix")) { reader.setFeature(NAMESPACE_PREFIXES_FEATURE, false); reader.parse(input); } else { throw e; } } }
|| name.equals(Feature.EXTERNAL_PARAMETER_ENTITIES)) { if (value) { throw new SAXNotSupportedException("Cannot enable " + name); } else { throw new SAXNotSupportedException("Cannot disable " + name); throw new SAXNotRecognizedException(name);
@Override public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (NAMESPACES_FEATURE_NAME.equals(name)) { return this.namespacesFeature; } else if (NAMESPACE_PREFIXES_FEATURE_NAME.equals(name)) { return this.namespacePrefixesFeature; } else if (IS_STANDALONE_FEATURE_NAME.equals(name)) { if (this.isStandalone != null) { return this.isStandalone; } else { throw new SAXNotSupportedException("startDocument() callback not completed yet"); } } else { return super.getFeature(name); } }
if (name.equals(CONFIGURED_XSTREAM_PROPERTY)) { if (!(value instanceof XStream)) { throw new SAXNotSupportedException("Value for property \"" + CONFIGURED_XSTREAM_PROPERTY + "\" must be a non-null XStream object"); throw new SAXNotSupportedException("Value for property \"" + SOURCE_OBJECT_LIST_PROPERTY + "\" shall not be an empty list"); throw new SAXNotSupportedException("Value for property \"" + SOURCE_OBJECT_LIST_PROPERTY + "\" must be a non-null List object"); throw new SAXNotRecognizedException(name);
final String nvdVer = attributes.getValue("nvd_xml_version"); if (!CURRENT_SCHEMA_VERSION.equals(nvdVer)) { throw new SAXNotSupportedException("Schema version " + nvdVer + " is not supported");
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { SAXProperty prop = SAXProperty.findByUri(name); if (prop == SAXProperty.DECLARATION_HANDLER) { mDeclHandler = (DeclHandler) value; return; } else if (prop == SAXProperty.DOCUMENT_XML_VERSION) { ; // read-only } else if (prop == SAXProperty.DOM_NODE) { ; // read-only } else if (prop == SAXProperty.LEXICAL_HANDLER) { mLexicalHandler = (LexicalHandler) value; return; } else if (prop == SAXProperty.XML_STRING) { ; // read-only } else { throw new SAXNotRecognizedException("Property '"+name+"' not recognized"); } // Trying to modify read-only properties? throw new SAXNotSupportedException("Property '"+name+"' is read-only, can not be modified"); }
final String nvdVer = attributes.getValue(NVD_XML_VERSION); if (!CURRENT_SCHEMA_VERSION.equals(nvdVer)) { throw new SAXNotSupportedException("Schema version " + nvdVer + " is not supported");
if (value != true) { throw new SAXNotSupportedException(name); } else { throw new SAXNotRecognizedException(name);