/** * Convenience method for subclasses to save the "onMatch" attribute * to an XML file when {@link XMLConfiguration} is used. * @param writer XML stream writer * @throws XMLStreamException problem saving extra content types */ protected void saveToXML(XMLStreamWriter writer) throws XMLStreamException { writer.writeAttribute("onMatch", onMatch.toString().toLowerCase()); }
/** * Convenience method for subclasses to load the "onMatch" * attribute from an XML file when {@link XMLConfiguration} is used. * @param xml XML configuration */ protected final void loadFromXML(XMLConfiguration xml) { OnMatch configOnMatch = OnMatch.INCLUDE; String onMatchStr = xml.getString( "[@onMatch]", OnMatch.INCLUDE.toString()).toUpperCase(); try { configOnMatch = OnMatch.valueOf(onMatchStr); } catch (IllegalArgumentException e) { throw new ConfigurationException("Configuration error: " + "Invalid \"onMatch\" attribute value: \"" + onMatchStr + "\". Must be one of \"include\" or \"exclude\".", e); } this.onMatch = configOnMatch; }