<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_18) on Sun Jun 12 19:55:30 JST 2011 --> <TITLE> XPathExpression (JAXP 1.4, DOM3, SAX2.0.2(sax2r3), StAX 1.0, SAC 1.3) </TITLE> <META NAME="date" CONTENT="2011-06-12"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="XPathExpression (JAXP 1.4, DOM3, SAX2.0.2(sax2r3), StAX 1.0, SAC 1.3)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/xml/xpath/XPathException.html" title="class in javax.xml.xpath"><B>PREV CLASS</B></A> <A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?javax/xml/xpath/XPathExpression.html" target="_top"><B>FRAMES</B></A> <A HREF="XPathExpression.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> javax.xml.xpath</FONT> <BR> Interface XPathExpression</H2> <HR> <DL> <DT><PRE>public interface <B>XPathExpression</B></DL> </PRE> <P> <p><code>XPathExpression</code> provides access to compiled XPath expressions.</p> <table id="XPathExpression-evaluation" border="1" cellpadding="2"> <thead> <tr> <th colspan="2">Evaluation of XPath Expressions.</th> </tr> </thead> <tbody> <tr> <td>context</td> <td> If a request is made to evaluate the expression in the absence of a context item, an empty document node will be used for the context. For the purposes of evaluating XPath expressions, a DocumentFragment is treated like a Document node. </td> </tr> <tr> <td>variables</td> <td> If the expression contains a variable reference, its value will be found through the <A HREF="../../../javax/xml/xpath/XPathVariableResolver.html" title="interface in javax.xml.xpath"><CODE>XPathVariableResolver</CODE></A>. An <A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath"><CODE>XPathExpressionException</CODE></A> is raised if the variable resolver is undefined or the resolver returns <code>null</code> for the variable. The value of a variable must be immutable through the course of any single evaluation.</p> </td> </tr> <tr> <td>functions</td> <td> If the expression contains a function reference, the function will be found through the <A HREF="../../../javax/xml/xpath/XPathFunctionResolver.html" title="interface in javax.xml.xpath"><CODE>XPathFunctionResolver</CODE></A>. An <A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath"><CODE>XPathExpressionException</CODE></A> is raised if the function resolver is undefined or the function resolver returns <code>null</code> for the function.</p> </td> </tr> <tr> <td>QNames</td> <td> QNames in the expression are resolved against the XPath namespace context. </td> </tr> <tr> <td>result</td> <td> This result of evaluating an expression is converted to an instance of the desired return type. Valid return types are defined in <A HREF="../../../javax/xml/xpath/XPathConstants.html" title="class in javax.xml.xpath"><CODE>XPathConstants</CODE></A>. Conversion to the return type follows XPath conversion rules.</p> </td> </tr> </table> <P> <P> <DL> <DT><B>Since:</B></DT> <DD>1.5</DD> <DT><B>Version:</B></DT> <DD>$Revision: 446598 $, $Date: 2006-09-15 15:55:40 +0300 (Fri, 15 Sep 2006) $</DD> <DT><B>Author:</B></DT> <DD><a href="mailto:Norman.Walsh@Sun.com">Norman Walsh</a>, <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a></DD> <DT><B>See Also:</B><DD><a href="http://www.w3.org/TR/xpath#section-Expressions">XML Path Language (XPath) Version 1.0, Expressions</a></DL> <HR> <P> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/xpath/XPathExpression.html#evaluate(org.xml.sax.InputSource)">evaluate</A></B>(<A HREF="../../../org/xml/sax/InputSource.html" title="class in org.xml.sax">InputSource</A> source)</CODE> <BR> Evaluate the compiled XPath expression in the context of the specified <code>InputSource</code> and return the result as a <code>String</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.lang.Object</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/xpath/XPathExpression.html#evaluate(org.xml.sax.InputSource, javax.xml.namespace.QName)">evaluate</A></B>(<A HREF="../../../org/xml/sax/InputSource.html" title="class in org.xml.sax">InputSource</A> source, <A HREF="../../../javax/xml/namespace/QName.html" title="class in javax.xml.namespace">QName</A> returnType)</CODE> <BR> Evaluate the compiled XPath expression in the context of the specified <code>InputSource</code> and return the result as the specified type.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/xpath/XPathExpression.html#evaluate(java.lang.Object)">evaluate</A></B>(java.lang.Object item)</CODE> <BR> Evaluate the compiled XPath expression in the specified context and return the result as a <code>String</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.lang.Object</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/xpath/XPathExpression.html#evaluate(java.lang.Object, javax.xml.namespace.QName)">evaluate</A></B>(java.lang.Object item, <A HREF="../../../javax/xml/namespace/QName.html" title="class in javax.xml.namespace">QName</A> returnType)</CODE> <BR> Evaluate the compiled XPath expression in the specified context and return the result as the specified type.</TD> </TR> </TABLE> <P> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="evaluate(java.lang.Object, javax.xml.namespace.QName)"><!-- --></A><H3> evaluate</H3> <PRE> java.lang.Object <B>evaluate</B>(java.lang.Object item, <A HREF="../../../javax/xml/namespace/QName.html" title="class in javax.xml.namespace">QName</A> returnType) throws <A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath">XPathExpressionException</A></PRE> <DL> <DD><p>Evaluate the compiled XPath expression in the specified context and return the result as the specified type.</p> <p>See <a href="#XPathExpression-evaluation">Evaluation of XPath Expressions</a> for context item evaluation, variable, function and QName resolution and return type conversion.</p> <p>If <code>returnType</code> is not one of the types defined in <A HREF="../../../javax/xml/xpath/XPathConstants.html" title="class in javax.xml.xpath"><CODE>XPathConstants</CODE></A>, then an <code>IllegalArgumentException</code> is thrown.</p> <p>If a <code>null</code> value is provided for <code>item</code>, an empty document will be used for the context. If <code>returnType</code> is <code>null</code>, then a <code>NullPointerException</code> is thrown.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>item</CODE> - The starting context (node or node list, for example).<DD><CODE>returnType</CODE> - The desired return type. <DT><B>Returns:</B><DD>The <code>Object</code> that is the result of evaluating the expression and converting the result to <code>returnType</code>. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath">XPathExpressionException</A></CODE> - If the expression cannot be evaluated. <DD><CODE>java.lang.IllegalArgumentException</CODE> - If <code>returnType</code> is not one of the types defined in <A HREF="../../../javax/xml/xpath/XPathConstants.html" title="class in javax.xml.xpath"><CODE>XPathConstants</CODE></A>. <DD><CODE>java.lang.NullPointerException</CODE> - If <code>returnType</code> is <code>null</code>.</DL> </DD> </DL> <HR> <A NAME="evaluate(java.lang.Object)"><!-- --></A><H3> evaluate</H3> <PRE> java.lang.String <B>evaluate</B>(java.lang.Object item) throws <A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath">XPathExpressionException</A></PRE> <DL> <DD><p>Evaluate the compiled XPath expression in the specified context and return the result as a <code>String</code>.</p> <p>This method calls <A HREF="../../../javax/xml/xpath/XPathExpression.html#evaluate(java.lang.Object, javax.xml.namespace.QName)"><CODE>evaluate(Object item, QName returnType)</CODE></A> with a <code>returnType</code> of <A HREF="../../../javax/xml/xpath/XPathConstants.html#STRING"><CODE>XPathConstants.STRING</CODE></A>.</p> <p>See <a href="#XPathExpression-evaluation">Evaluation of XPath Expressions</a> for context item evaluation, variable, function and QName resolution and return type conversion.</p> <p>If a <code>null</code> value is provided for <code>item</code>, an empty document will be used for the context. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>item</CODE> - The starting context (node or node list, for example). <DT><B>Returns:</B><DD>The <code>String</code> that is the result of evaluating the expression and converting the result to a <code>String</code>. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath">XPathExpressionException</A></CODE> - If the expression cannot be evaluated.</DL> </DD> </DL> <HR> <A NAME="evaluate(org.xml.sax.InputSource, javax.xml.namespace.QName)"><!-- --></A><H3> evaluate</H3> <PRE> java.lang.Object <B>evaluate</B>(<A HREF="../../../org/xml/sax/InputSource.html" title="class in org.xml.sax">InputSource</A> source, <A HREF="../../../javax/xml/namespace/QName.html" title="class in javax.xml.namespace">QName</A> returnType) throws <A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath">XPathExpressionException</A></PRE> <DL> <DD><p>Evaluate the compiled XPath expression in the context of the specified <code>InputSource</code> and return the result as the specified type.</p> <p>This method builds a data model for the <A HREF="../../../org/xml/sax/InputSource.html" title="class in org.xml.sax"><CODE>InputSource</CODE></A> and calls <A HREF="../../../javax/xml/xpath/XPathExpression.html#evaluate(java.lang.Object, javax.xml.namespace.QName)"><CODE>evaluate(Object item, QName returnType)</CODE></A> on the resulting document object.</p> <p>See <a href="#XPathExpression-evaluation">Evaluation of XPath Expressions</a> for context item evaluation, variable, function and QName resolution and return type conversion.</p> <p>If <code>returnType</code> is not one of the types defined in <A HREF="../../../javax/xml/xpath/XPathConstants.html" title="class in javax.xml.xpath"><CODE>XPathConstants</CODE></A>, then an <code>IllegalArgumentException</code> is thrown.</p> <p>If <code>source</code> or <code>returnType</code> is <code>null</code>, then a <code>NullPointerException</code> is thrown.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>source</CODE> - The <code>InputSource</code> of the document to evaluate over.<DD><CODE>returnType</CODE> - The desired return type. <DT><B>Returns:</B><DD>The <code>Object</code> that is the result of evaluating the expression and converting the result to <code>returnType</code>. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath">XPathExpressionException</A></CODE> - If the expression cannot be evaluated. <DD><CODE>java.lang.IllegalArgumentException</CODE> - If <code>returnType</code> is not one of the types defined in <A HREF="../../../javax/xml/xpath/XPathConstants.html" title="class in javax.xml.xpath"><CODE>XPathConstants</CODE></A>. <DD><CODE>java.lang.NullPointerException</CODE> - If <code>source</code> or <code>returnType</code> is <code>null</code>.</DL> </DD> </DL> <HR> <A NAME="evaluate(org.xml.sax.InputSource)"><!-- --></A><H3> evaluate</H3> <PRE> java.lang.String <B>evaluate</B>(<A HREF="../../../org/xml/sax/InputSource.html" title="class in org.xml.sax">InputSource</A> source) throws <A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath">XPathExpressionException</A></PRE> <DL> <DD><p>Evaluate the compiled XPath expression in the context of the specified <code>InputSource</code> and return the result as a <code>String</code>.</p> <p>This method calls <A HREF="../../../javax/xml/xpath/XPathExpression.html#evaluate(org.xml.sax.InputSource, javax.xml.namespace.QName)"><CODE>evaluate(InputSource source, QName returnType)</CODE></A> with a <code>returnType</code> of <A HREF="../../../javax/xml/xpath/XPathConstants.html#STRING"><CODE>XPathConstants.STRING</CODE></A>.</p> <p>See <a href="#XPathExpression-evaluation">Evaluation of XPath Expressions</a> for context item evaluation, variable, function and QName resolution and return type conversion.</p> <p>If <code>source</code> is <code>null</code>, then a <code>NullPointerException</code> is thrown.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>source</CODE> - The <code>InputSource</code> of the document to evaluate over. <DT><B>Returns:</B><DD>The <code>String</code> that is the result of evaluating the expression and converting the result to a <code>String</code>. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath">XPathExpressionException</A></CODE> - If the expression cannot be evaluated. <DD><CODE>java.lang.NullPointerException</CODE> - If <code>source</code> is <code>null</code>.</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/xml/xpath/XPathException.html" title="class in javax.xml.xpath"><B>PREV CLASS</B></A> <A HREF="../../../javax/xml/xpath/XPathExpressionException.html" title="class in javax.xml.xpath"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?javax/xml/xpath/XPathExpression.html" target="_top"><B>FRAMES</B></A> <A HREF="XPathExpression.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>