public class XMLMessageHandler extends org.xml.sax.helpers.DefaultHandler
A content handler for SAX, the Simple API for XML, that transforms the SAX events of serialized messages into message objects.
Note that this handler assumes that the XML events are valid, possibly leading to unexpected behavior if this assumption does not hold. If in doubt regarding the validity of your XML, you should turn on validation against the FIPA DTD in your parser.
Note that the FIPA standard XML representation of ACL messages allows
specifying the conversation-id
as both an attribute and an
element of the message XML element. This may lead to contradictory situation
if both contain different identifiers. This class resolves such situations in
that the element overrides the attribute. In case of multiple occurrences of
other elements only expected once, the last occurrence defines the value of
the resulting message.
XMLMessageWriter
,
FIPA ACL
Message Representation in XML SpecificationConstructor and Description |
---|
XMLMessageHandler(MessageHandler handler)
Instantiates this handler with a message handler that is notified about
messages read.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] characters,
int start,
int length) |
void |
endElement(String uri,
String localName,
String qName) |
void |
startElement(String uri,
String localName,
String qName,
Attributes attributes) |
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
public XMLMessageHandler(MessageHandler handler)
handler
- the underlying message handler.public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void characters(char[] characters, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
SAXException
Copyright © Aimpulse Intelligent Systems GmbH
All rights reserved.