Package org.infozone.tools.xml.queries.xt

Source Code of org.infozone.tools.xml.queries.xt.XPathQueryImpl

// You can redistribute this software and/or modify it under the terms of
// the Infozone Software License version 2 published by the Infozone Group
// (http://www.infozone-group.org).
//
// Copyright (C) @year@ by The Infozone Group. All rights reserved.
//
// $Id: XPathQueryImpl.java,v 1.1 2002/05/10 08:59:12 per_nyfelt Exp $


package org.infozone.tools.xml.queries.xt;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.traversal.NodeFilter;

import org.infozone.tools.xml.queries.XObject;
import org.infozone.tools.xml.queries.XPathQuery;

import com.fujitsu.xml.omquery.DomQueryMgr;


/**
* @version $Revision: 1.1 $ $Date: 2002/05/10 08:59:12 $
* @author <a href="http://www.softwarebuero.de">SMB</a>
*/
public final class XPathQueryImpl implements XPathQuery {
   
    //
    // Data
    //

    private String              qstring;
   

    public void setQString( String qstring ) throws Exception {
        this.qstring = qstring;
    }


    public void setNamespace( Node namespace ) throws Exception {
        throw new UnsupportedOperationException( "" );
    }


    public void setNodeFilter( NodeFilter filter ) throws Exception {
        throw new UnsupportedOperationException( "" );
    }
   
   
    public XObject execute( Node rootNode ) throws Exception {

        if (rootNode.getNodeType () == Node.DOCUMENT_NODE)
            rootNode = ((Document)rootNode).getDocumentElement ();

        DomQueryMgr queryMgr = new DomQueryMgr( rootNode.getOwnerDocument() );
        return new XObjectImpl( queryMgr.getNodesByXPath( rootNode, qstring ) );
    }
}
TOP

Related Classes of org.infozone.tools.xml.queries.xt.XPathQueryImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.