01: // You can redistribute this software and/or modify it under the terms of
02: // the Infozone Software License version 2 published by the Infozone Group
03: // (http://www.infozone-group.org).
04: //
05: // Copyright (C) @year@ by The Infozone Group. All rights reserved.
06: //
07: // $Id: XPathQueryImpl.java,v 1.1 2002/05/10 08:59:12 per_nyfelt Exp $
08:
09: package org.infozone.tools.xml.queries.xt;
10:
11: import org.w3c.dom.Document;
12: import org.w3c.dom.Node;
13: import org.w3c.dom.traversal.NodeFilter;
14:
15: import org.infozone.tools.xml.queries.XObject;
16: import org.infozone.tools.xml.queries.XPathQuery;
17:
18: import com.fujitsu.xml.omquery.DomQueryMgr;
19:
20: /**
21: * @version $Revision: 1.1 $ $Date: 2002/05/10 08:59:12 $
22: * @author <a href="http://www.softwarebuero.de">SMB</a>
23: */
24: public final class XPathQueryImpl implements XPathQuery {
25:
26: //
27: // Data
28: //
29:
30: private String qstring;
31:
32: public void setQString(String qstring) throws Exception {
33: this .qstring = qstring;
34: }
35:
36: public void setNamespace(Node namespace) throws Exception {
37: throw new UnsupportedOperationException("");
38: }
39:
40: public void setNodeFilter(NodeFilter filter) throws Exception {
41: throw new UnsupportedOperationException("");
42: }
43:
44: public XObject execute(Node rootNode) throws Exception {
45:
46: if (rootNode.getNodeType() == Node.DOCUMENT_NODE)
47: rootNode = ((Document) rootNode).getDocumentElement();
48:
49: DomQueryMgr queryMgr = new DomQueryMgr(rootNode
50: .getOwnerDocument());
51: return new XObjectImpl(queryMgr.getNodesByXPath(rootNode,
52: qstring));
53: }
54: }
|