01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.geoserver.ows;
06:
07: import org.geotools.util.Version;
08: import org.w3c.dom.Document;
09: import org.xml.sax.InputSource;
10: import java.io.Reader;
11: import java.util.Map;
12:
13: import javax.xml.namespace.QName;
14: import javax.xml.parsers.DocumentBuilder;
15: import javax.xml.parsers.DocumentBuilderFactory;
16:
17: public class MessageXmlParser extends XmlRequestReader {
18: public MessageXmlParser() {
19: super (new QName(null, "Hello"), new Version("1.0.0"), "hello");
20: }
21:
22: public Object read(Object request, Reader reader, Map kvp)
23: throws Exception {
24: DocumentBuilder builder = DocumentBuilderFactory.newInstance()
25: .newDocumentBuilder();
26:
27: Document doc = builder.parse(new InputSource(reader));
28: String message = doc.getDocumentElement().getAttribute(
29: "message");
30:
31: return new Message(message);
32: }
33: }
|