1 9 package org.ozoneDB.xml.util; 10 11 import java.io.*; 12 13 import org.w3c.dom.Node ; 14 import org.w3c.dom.traversal.NodeFilter; 15 import org.infozone.tools.xml.queries.XObject; 16 import org.infozone.tools.xml.queries.XPathQuery; 17 18 26 public final class OzoneXPathQuery implements XPathQuery, Externalizable { 27 28 protected final static long serialVersionUID = 1L; 29 30 protected String qstring; 31 32 protected NodeFilter filter; 33 34 protected Node namespace; 35 36 protected Node rootNode; 37 38 protected transient XMLContainer delegate; 39 40 public OzoneXPathQuery() { 41 } 42 43 protected OzoneXPathQuery(XMLContainer _delegate) { 44 delegate = _delegate; 45 } 46 47 public void setQString(String _qstring) throws Exception { 48 qstring = _qstring; 49 } 50 51 public void setNamespace(Node _namespace) throws Exception { 52 namespace = _namespace; 53 } 54 55 public void setNodeFilter(NodeFilter _filter) throws Exception { 56 filter = _filter; 57 } 58 59 64 public XObject execute() throws Exception { 65 return execute(null); 66 } 67 68 75 public XObject execute(Node _rootNode) throws Exception { 76 rootNode = _rootNode; 77 return delegate.executeXPath(this); 78 } 79 80 public void writeExternal(ObjectOutput out) throws IOException { 81 out.writeObject(rootNode); 82 out.writeObject(qstring); 83 out.writeObject(filter); 84 out.writeObject(namespace); 85 } 86 87 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { 88 rootNode = (Node ) in.readObject(); 89 qstring = (String ) in.readObject(); 90 filter = (NodeFilter) in.readObject(); 91 namespace = (Node ) in.readObject(); 92 } 93 } | Popular Tags |