com.fujitsu.xml.omquery
Class XtOmQueryMgr

java.lang.Object
  extended by com.fujitsu.xml.omquery.OmQueryMgrBase
      extended by com.fujitsu.xml.omquery.XtOmQueryMgr

public class XtOmQueryMgr
extends OmQueryMgrBase

A class which provides XPath API facility by interfacing with James Clark's XT.


For example:
   InputSource input = new InputSource(createURL("sample.xml"));

   XtOmQueryMgr query_mgr = new XtOmQueryMgr();
   Node node = query_mgr.load(input);

   Enumeration iter = query_mgr.getNodesByXPath(node, "(A/B/C)[2]");
 

Author:
Takuki Kamiya

Nested Class Summary
 
Nested classes/interfaces inherited from class com.fujitsu.xml.omquery.OmQueryMgrBase
OmQueryMgrBase.MyExprContext, OmQueryMgrBase.MyLoadContext, OmQueryMgrBase.MyVariableMgr
 
Field Summary
 
Fields inherited from class com.fujitsu.xml.omquery.OmQueryMgrBase
nametbl
 
Constructor Summary
XtOmQueryMgr()
          Constructs a OM Query Manager.
 
Method Summary
 java.util.Enumeration getNodesByXPath(com.jclark.xsl.om.Node node, java.lang.String selector)
          Performs XPath query on top of XT's OM (Object Model).
 com.jclark.xsl.om.Node load(org.xml.sax.InputSource is)
          Parse XML file or stream to build XT's OM (Object Model).
 
Methods inherited from class com.fujitsu.xml.omquery.OmQueryMgrBase
getBooleanWithXPath, getBooleanWithXPath, getBooleanWithXPath, getNameTable, getNodesWithXPath, getNodesWithXPath, getNodesWithXPath, getNumberWithXPath, getNumberWithXPath, getNumberWithXPath, getStringWithXPath, getStringWithXPath, getStringWithXPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XtOmQueryMgr

public XtOmQueryMgr()
             throws org.xml.sax.SAXException
Constructs a OM Query Manager. OM Query Manager insulates applocations from knowing miscllaneous house keeping procedures required to use XT's internal modules which provides the actual capability of XPath querying. The constructor creates a SAX parser based on the value of system property "org.sax.parser".

Throws:
org.xml.sax.SAXException - thrown if a SAX parser failed to be created.
Method Detail

load

public com.jclark.xsl.om.Node load(org.xml.sax.InputSource is)
                            throws java.io.IOException
Parse XML file or stream to build XT's OM (Object Model). Parses XML and returns com.jclark.xsl.om.Node which represents root node for the specified input XML file or stream.

Parameters:
is - XML file or stream represented as InputSource
Returns:
Root Node object
Throws:
java.io.IOException

getNodesByXPath

public java.util.Enumeration getNodesByXPath(com.jclark.xsl.om.Node node,
                                             java.lang.String selector)
                                      throws com.jclark.xsl.om.XSLException
Performs XPath query on top of XT's OM (Object Model). Returns Enumeration with which to iterate through Nodes that matched the specified selector.

Parameters:
node - the node where query processing starts from.
selector - XPath query string
Returns:
Enumeration of XT's OM (Object Model) Nodes for iterating through the query result
Throws:
com.jclark.xsl.om.XSLException