Package org.apache.lenya.xml

Examples of org.apache.lenya.xml.XPath


            String xupdateInsertAfter = null;
            if (parent) {
                xa = getAttributes(request.getParameter(pname), xa.tagID);
                xupdateInsertAfter = "<xupdate:insert-after select=\"" + select
                        + " \"><xupdate:element name=\""
                        + new XPath(select).getNameWithoutPredicates() + "\"" + namespaceAttribute
                        + ">" + xa.xupdateAttrExpr + removeParent(request.getParameter(pname))
                        + "</xupdate:element></xupdate:insert-after>";
            } else {
                xupdateInsertAfter = "<xupdate:insert-after select=\"" + select
                        + " \"><xupdate:element name=\""
                        + new XPath(select).getNameWithoutPredicates() + "\"" + namespaceAttribute
                        + ">" + xa.xupdateAttrExpr + request.getParameter(pname)
                        + "</xupdate:element></xupdate:insert-after>";
            }
            getLogger().debug(".update(): Update Node (insert-after): " + xupdateInsertAfter);

            String xupdateRemove = "<xupdate:remove select=\"" + select + " \"/>";
            getLogger().debug(".update(): Update Node (remove): " + xupdateRemove);

            String xupdateUpdateAttribute = "<xupdate:update select=\""
                    + new XPath(select).removePredicates(select) + "[@tagID='temp']/@tagID"
                    + " \">" + xa.tagID + "</xupdate:update>";
            getLogger().debug(".update(): Update Node (update tagID attribute): "
                    + xupdateUpdateAttribute);

            return "<xupdate:modifications xmlns:xupdate=\"http://www.xmldb.org/xupdate\">"
View Full Code Here


     * @throws Exception DOCUMENT ME!
     */
    public void configure(Element root) throws Exception {
        DOMUtil du = new DOMUtil();

        base_url = du.getAttributeValue(root, new XPath("base-url/@href"));
        scope_url = du.getAttributeValue(root, new XPath("scope-url/@href"));
        user_agent = du.getElementValue(root, new XPath("user-agent"));
        uri_list = du.getAttributeValue(root, new XPath("uri-list/@src"));
        htdocs_dump_dir = du.getAttributeValue(root, new XPath("htdocs-dump-dir/@src"));
        if (du.elementExists(root, new XPath("robots"))) {
            robots_file = du.getAttributeValue(root, new XPath("robots/@src"));
            robots_domain = du.getAttributeValue(root, new XPath("robots/@domain"));
        }
    }
View Full Code Here

     *
     * @throws Exception DOCUMENT ME!
     */
    public void configure(Element root) throws Exception {
        DOMUtil du = new DOMUtil();
        update_index_type = du.getAttributeValue(root, new XPath("update-index/@type"));
        index_dir = du.getAttributeValue(root, new XPath("index-dir/@src"));
        htdocs_dump_dir = du.getAttributeValue(root, new XPath("htdocs-dump-dir/@src"));

        String indexerClassName = du.getAttributeValue(root, new XPath("indexer/@class"));
        indexerClass = Class.forName(indexerClassName);
    }
View Full Code Here

            DOMUtil du = new DOMUtil();
            String path = argv[0];
           
            Document config = DocumentHelper.readDocument(new File(path));
            indexer.configure(du.getElement(config.getDocumentElement(), new XPath("indexer")), argv[0]);

            if (argv.length == 2) {
                indexer.indexDocument(new File(argv[1]));
                return;
            }
View Full Code Here

    public static Indexer getIndexer(String luceneConfig) throws Exception {
        IndexConfiguration ie = new IndexConfiguration(luceneConfig);
        Indexer indexer = (Indexer) ie.getIndexerClass().newInstance();
        DOMUtil du = new DOMUtil();
        Document config = DocumentHelper.readDocument(new File(luceneConfig));
        indexer.configure(du.getElement(config.getDocumentElement(), new XPath("indexer")), luceneConfig);

        return indexer;
    }
View Full Code Here

     * @throws Exception DOCUMENT ME!
     */
    public void configure(Element root) throws Exception {
        DOMUtil du = new DOMUtil();

        base_url = du.getAttributeValue(root, new XPath("base-url/@href"));
        scope_url = du.getAttributeValue(root, new XPath("scope-url/@href"));
        user_agent = du.getElementValue(root, new XPath("user-agent"));
        uri_list = du.getAttributeValue(root, new XPath("uri-list/@src"));
        htdocs_dump_dir = du.getAttributeValue(root, new XPath("htdocs-dump-dir/@src"));
        if (du.elementExists(root, new XPath("robots"))) {
            robots_file = du.getAttributeValue(root, new XPath("robots/@src"));
            robots_domain = du.getAttributeValue(root, new XPath("robots/@domain"));
        }
    }
View Full Code Here

        XUpdateAttributes xa = getAttributes(nodeToUpdate);
        String xupdateInsertAfter = null;
        if (parent) {
            xa = getAttributes(getParameterAsString(pname), xa.tagID);
            xupdateInsertAfter = "<xupdate:insert-after select=\"" + select
                    + " \"><xupdate:element name=\"" + new XPath(select).getNameWithoutPredicates()
                    + "\"" + namespaceAttribute + ">" + xa.xupdateAttrExpr
                    + removeParent(getParameterAsString(pname))
                    + "</xupdate:element></xupdate:insert-after>";
        } else {
            xupdateInsertAfter = "<xupdate:insert-after select=\"" + select
                    + " \"><xupdate:element name=\"" + new XPath(select).getNameWithoutPredicates()
                    + "\"" + namespaceAttribute + ">" + xa.xupdateAttrExpr
                    + getParameterAsString(pname) + "</xupdate:element></xupdate:insert-after>";
        }
        getLogger().debug(".update(): Update Node (insert-after): " + xupdateInsertAfter);

        String xupdateRemove = "<xupdate:remove select=\"" + select + " \"/>";
        getLogger().debug(".update(): Update Node (remove): " + xupdateRemove);

        String xupdateUpdateAttribute = "<xupdate:update select=\""
                + new XPath(select).removePredicates(select) + "[@tagID='temp']/@tagID" + " \">"
                + xa.tagID + "</xupdate:update>";
        getLogger().debug(".update(): Update Node (update tagID attribute): "
                + xupdateUpdateAttribute);

        return "<xupdate:modifications xmlns:xupdate=\"http://www.xmldb.org/xupdate\">"
View Full Code Here

        if (namespace != null) {
            namespaceAttribute = " namespace=\"" + namespace + "\"";
        }
        // WARNING: getAttributes adds the attribute tagID with value "temp"
        XUpdateAttributes xa = getAttributes(nodeToCopy);
        String xupdateInsertAfter = "<xupdate:insert-after select=\"" + select  + " \"><xupdate:element name=\"" + new XPath(select).getNameWithoutPredicates()  + "\"" + namespaceAttribute  + ">" + xa.xupdateAttrExpr + request.getParameter(pname+ "</xupdate:element></xupdate:insert-after>";
        log.debug(".update(): Update Node (insert-after): " + xupdateInsertAfter);
        String xupdateRemove = "<xupdate:remove select=\"" + select  + " \"/>";
        log.debug(".update(): Update Node (remove): " + xupdateRemove);
        String xupdateUpdateAttribute = "<xupdate:update select=\"" + new XPath(select).removePredicates(select) + "[@tagID='temp']/@tagID"  + " \">" + xa.tagID  + "</xupdate:update>";
        log.debug(".update(): Update Node (update tagID attribute): " + xupdateUpdateAttribute);
        return "<?xml version=\"1.0\"?><xupdate:modifications xmlns:xupdate=\"http://www.xmldb.org/xupdate\">" + xupdateInsertAfter + xupdateRemove + xupdateUpdateAttribute  + "</xupdate:modifications>";

/*
        String xupdateUpdate = pname + request.getParameter(pname) + "</xupdate:update>";
View Full Code Here

        XUpdateAttributes xa = getAttributes(nodeToUpdate);
        String xupdateInsertAfter = null;
        if (parent) {
            xa = getAttributes(getParameterAsString(pname), xa.tagID);
            xupdateInsertAfter = "<xupdate:insert-after select=\"" + select
                    + " \"><xupdate:element name=\"" + new XPath(select).getNameWithoutPredicates()
                    + "\"" + namespaceAttribute + ">" + xa.xupdateAttrExpr
                    + removeParent(getParameterAsString(pname))
                    + "</xupdate:element></xupdate:insert-after>";
        } else {
            xupdateInsertAfter = "<xupdate:insert-after select=\"" + select
                    + " \"><xupdate:element name=\"" + new XPath(select).getNameWithoutPredicates()
                    + "\"" + namespaceAttribute + ">" + xa.xupdateAttrExpr
                    + getParameterAsString(pname) + "</xupdate:element></xupdate:insert-after>";
        }
        getLogger().debug(".update(): Update Node (insert-after): " + xupdateInsertAfter);

        String xupdateRemove = "<xupdate:remove select=\"" + select + " \"/>";
        getLogger().debug(".update(): Update Node (remove): " + xupdateRemove);

        String xupdateUpdateAttribute = "<xupdate:update select=\""
                + new XPath(select).removePredicates(select) + "[@tagID='temp']/@tagID" + " \">"
                + xa.tagID + "</xupdate:update>";
        getLogger().debug(".update(): Update Node (update tagID attribute): "
                + xupdateUpdateAttribute);

        return "<xupdate:modifications xmlns:xupdate=\"http://www.xmldb.org/xupdate\">"
View Full Code Here

            DOMUtil du = new DOMUtil();
            String path = argv[0];
           
            Document config = DocumentHelper.readDocument(new File(path));
            indexer.configure(du.getElement(config.getDocumentElement(), new XPath("indexer")), argv[0]);

            if (argv.length == 2) {
                indexer.indexDocument(new File(argv[1]));
                return;
            }
View Full Code Here

TOP

Related Classes of org.apache.lenya.xml.XPath

Copyright © 2018 www.massapicom. 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.