Package org.dom4j

Examples of org.dom4j.XPath.selectNodes()


        }

        getLogger().debug("XPATH: " + xpath_string);

        XPath xpathSelector = DocumentHelper.createXPath(xpath_string);
        List nodes = xpathSelector.selectNodes(doc);

        if (nodes.isEmpty()) {
            getLogger().error(".act(): No nodes: " + xpath_string);
            getLogger().error(".act(): No child added!");
View Full Code Here


        }

        getLogger().debug("XPATH: " + xpath_string);

        XPath xpathSelector = DocumentHelper.createXPath(xpath_string);
        List nodes = xpathSelector.selectNodes(doc);

        if (nodes.isEmpty()) {
            getLogger().error(".act(): No nodes: " + xpath_string);
            getLogger().error(".act(): No child added!");
View Full Code Here

        DocumentFactory factory = DocumentFactory.getInstance();

        XPath headlineXPath = factory.createXPath(headlinePath);

        List nodes = headlineXPath.selectNodes(articleDocument, headlineXPath);

        Element headlineElement = (Element) nodes.get(0);

        String title = headlineElement.getText();
View Full Code Here

        String headlinePath = "/NewsML" + "/NewsItem" + "/NewsComponent" + "/ContentItem" +
            "/DataContent" + "/nitf" + "/body" + "/body.head" + "/hedline" + "/hl1";

        DocumentFactory factory = DocumentFactory.getInstance();
        XPath headlineXPath = factory.createXPath(headlinePath);
        List nodes = headlineXPath.selectNodes(articleDocument, headlineXPath);
        Element headlineElement = (Element) nodes.get(0);
        String title = headlineElement.getText();

        //article's  channel, section, year, id. FIXME: should be readen from the article, but now:
        StringTokenizer st = new StringTokenizer(docId, "/");
View Full Code Here

            backupFile(articlePath);

            // on we go
            XPath articleXPath = factory.createXPath(
                    "/NewsML/NewsItem/NewsComponent/ContentItem/DataContent/nitf/body/body.head");
            List parentNodes = articleXPath.selectNodes(articleDocument);
            Element parent = null;

            if (parentNodes.size() > 0) {
                parent = (Element) parentNodes.get(0);
                log.debug("\n--------------------------" + "\n- Parent element: " +
View Full Code Here

                    File oldDossierFile = new File(oldDossierPath);

                    Document oldDossierDocument = reader.read(oldDossierFile);

                    XPath dossierXPath = factory.createXPath("/dossier/articles");
                    List oldArticlesElements = dossierXPath.selectNodes(oldDossierDocument);
                    Element oldArticlesElement = null;

                    if (oldArticlesElements.size() > 0) {
                        oldArticlesElement = (Element) oldArticlesElements.get(0);
                        log.debug("\n--------------------------" +
View Full Code Here

                    log.debug("New dossier file: " + newDossierFile.getPath());

                    Document newDossierDocument = reader.read(newDossierFile);

                    XPath dossierXPath = factory.createXPath("/dossier/articles");
                    List articlesElements = dossierXPath.selectNodes(newDossierDocument);
                    Element articlesElement = null;

                    if (articlesElements.size() > 0) {
                        articlesElement = (Element) articlesElements.get(0);
                        log.debug("\n--------------------------" + "\n- Parent element: " +
View Full Code Here

            String headlinePath = "/dossier" + "/head" + "/title";

            DocumentFactory factory = DocumentFactory.getInstance();
            XPath headlineXPath = factory.createXPath(headlinePath);
            List nodes = headlineXPath.selectNodes(dossierDocument, headlineXPath);
            Element headlineElement = (Element) nodes.get(0);
            String title = headlineElement.getText();

            String dossiersFilename = publicationPath + authoringPath + "/frontpage/dossier.xml";
View Full Code Here

        }

        getLogger().debug("XPATH: " + xpath_string);

        XPath xpathSelector = DocumentHelper.createXPath(xpath_string);
        List nodes = xpathSelector.selectNodes(doc);

        if (nodes.isEmpty()) {
            getLogger().error(".act(): No nodes: " + xpath_string);
            getLogger().error(".act(): No child added!");
View Full Code Here

        xPath.setNamespaceURIs(Collections.singletonMap("xdt", XdtConstants.XDT_NAMESPACE));


        Document workingCopy = (Document) inputDocument.clone();

        List<Element> xdtNode = xPath.selectNodes(transformDocument);

        List<Transform> transformToApply = new ArrayList<Transform>();

        if (log.isInfoEnabled())
            log.info("Found {} elements to process", xdtNode.size());
View Full Code Here

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.