Package org.ametys.core.userpref
Class UserPrefsHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.ametys.core.userpref.UserPrefsHandler
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
public class UserPrefsHandler extends DefaultHandler
This class is intended to be use as a simple helper to construct Maps from SAX events.
The incoming SAX document must follow this structure :
<UserPreferences>
<Name1>value1</Name1>
<Name2>value2</Name2>
...
</UserPreferences>
or
<UserPreferences>
<preference id="Name1">value1</preference>
<preference id="Name1">value2</preference>
...
</UserPreferences>
Each pair Name/Value will be put (as Strings) in the constructed Map
-
-
Constructor Summary
Constructors Constructor Description UserPrefsHandler(Map<String,String> map)
Create a map handler
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int length)
void
endElement(String uri, String localName, String qName)
void
startElement(String uri, String localName, String qName, Attributes attributes)
-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Constructor Detail
-
UserPrefsHandler
public UserPrefsHandler(Map<String,String> map)
Create a map handler- Parameters:
map
- Map to fill
-
-
Method Detail
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int length) throws SAXException
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- Throws:
SAXException
-
endElement
public void endElement(String uri, String localName, String qName) throws SAXException
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
-