// Parse document
try {
// Get handler for root element
ProtocolTagHandler protocolTagHandler =
new ProtocolTagHandler();
// Set up document handler
DocumentHandler contentHandler = new DocumentHandler(
"protocol", protocolTagHandler);
// Set up XML parser
XMLReader parser = XMLReaderFactory.createXMLReader();
parser.setContentHandler(contentHandler);
// Read and parse file
InputStream xml = new BufferedInputStream(input);
parser.parse(new InputSource(xml));
xml.close();
// Return parsed protocol
return protocolTagHandler.asProtocolInfo();
}
catch (IOException e) {
throw new GuacamoleException("Error reading basic user mapping file.", e);
}