| Subject: RE: XPath against a Document From: "Timm, Sean" <STimm@xxxxxxxxxx> Date: Tue, 15 Feb 2000 14:43:41 -0700 | 
    /**
     * This method searches for a specific set of nodes based on the XPath
     * statement passed into it.
     * 
     * @param baseNode Base node to process XPath statement against
     * @param sPath XPath statement to execute against baseNode
     * @return NodeList NodeList populated by nodes that match XPath
expression
     */
    public static final NodeList getNodesByXPath(Node baseNode, String
sPath)
        throws Exception
    {
        String parserLiaisonClassName = Constants.LIAISON_CLASS;
        Class parserLiaisonClass = Class.forName(parserLiaisonClassName);
        Constructor parserLiaisonCtor =
parserLiaisonClass.getConstructor(null);
        XMLParserLiaison parserLiaison
        = (XMLParserLiaison)parserLiaisonCtor.newInstance(null);     
        // Create a XPath parser.
        XPathProcessorImpl parser = new XPathProcessorImpl();
              
        // Create the XPath object.
        XPath xpath = new XPath();
              
        // Parse the xpath
        parser.initXPath(xpath, sPath, null);
        XObject xobj = xpath.execute(parserLiaison, baseNode, null);
        return xobj.nodeset();
    }
- Sean T.
-----Original Message-----
From: Ben Bertola [mailto:bbertola@xxxxxxxxxxxx]
Sent: Tuesday, February 15, 2000 3:49 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: Re: XPath against a Document
I have this same question, this would be great to know if it's possible.
Thanks,
Ben
Paul Levin wrote:
> Using Xerces and Xalan;
>     given a Document (i.e. DocumentImpl) and given a String containing
> an XPath expression, I would like to apply the expression against the
> document to obtain the NodeList that matchs the expression.  Is this
> possible ?
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: XPath against a Document, Ben Bertola | Thread | RE: XPath against a Document, Brian Dupras | 
| XSL & DTD question, Paul Bell | Date | RE: XPath against a Document, Brian Dupras | 
| Month |