Package org.xmldb.common.xml.queries

Examples of org.xmldb.common.xml.queries.XPathQuery


                    DocumentBuilder builder = parserFactory.newDocumentBuilder();
                    document = builder.parse(file.getAbsolutePath());
                    System.setProperty("org.xmldb.common.xml.queries.XPathQueryFactory",
                            "org.xmldb.common.xml.queries.xalan2.XPathQueryFactoryImpl");

                    XPathQuery xpath = XPathQueryFactory.newInstance().newXPathQuery();
                    XUpdateQuery xq = new XUpdateQueryImpl();

                    String editSelect = null;
                    String insertSelect = null;
                    Enumeration params = request.getParameterNames();
                    while (params.hasMoreElements()) {
                        String pname = (String) params.nextElement();
                        getLogger().debug("Parameter: " + pname + " ("
                                + request.getParameter(pname) + ")");

                        // Extract the xpath to edit
                        if (editSelect == null && pname.indexOf("edit[") >= 0
                                && pname.endsWith("].x")) {
                            editSelect = pname.substring(5, pname.length() - 3);
                            getLogger().debug("Edit: " + editSelect);
                        }
                       
                        // Make sure we are dealing with an xupdate statement,
                        // else skip
                        if (pname.indexOf("<xupdate:") == 0) {
                            String select = pname.substring(pname.indexOf("select") + 8);
                            select = select.substring(0, select.indexOf("\""));
                            getLogger().debug(".act() Select Node: " + select);

                            // Check if node exists
                            xpath.setQString(select);
                            XObject result = xpath.execute(document);
                            NodeList selectionNodeList = result.nodeset();
                            if (selectionNodeList.getLength() == 0) {
                                getLogger()
                                        .debug(".act(): Node does not exist (might have been deleted during update): "
                                                + select);
View Full Code Here


                    parserFactory.setIgnoringElementContentWhitespace(true);
                    DocumentBuilder builder = parserFactory.newDocumentBuilder();
                    document = builder.parse(file.getAbsolutePath());
                    System.setProperty("org.xmldb.common.xml.queries.XPathQueryFactory", "org.xmldb.common.xml.queries.xalan2.XPathQueryFactoryImpl");

                    XPathQuery xpath = XPathQueryFactory.newInstance().newXPathQuery();
                    XUpdateQuery xq = new XUpdateQueryImpl();

                    String editSelect = null;
                    Enumeration params = request.getParameterNames();
                    while (params.hasMoreElements()) {
                        String pname = (String) params.nextElement();
                        log.debug("Parameter: " + pname + " (" + request.getParameter(pname+ ")");

                        if (editSelect == null && pname.indexOf("edit[") >= 0 && pname.endsWith("].x")) {
                            editSelect = pname.substring(5, pname.length() - 3);
                           log.debug("Edit: " + editSelect);
                        }

                        if (pname.indexOf("<xupdate:") == 0) {
                            String select = pname.substring(pname.indexOf("select") + 8);
                            select = select.substring(0, select.indexOf("\""));
                            log.debug(".act() Select Node: " + select);

                            // Check if node exists
                            xpath.setQString(select);
                            XObject result = xpath.execute(document);
                            NodeList selectionNodeList = result.nodeset();
                            if (selectionNodeList.getLength() == 0) {
                                log.warn(".act(): Node does not exist (might have been deleted during update): " + select);
                            } else {
                                String xupdateModifications = null;
View Full Code Here

                    parserFactory.setIgnoringElementContentWhitespace(true);
                    DocumentBuilder builder = parserFactory.newDocumentBuilder();
                    document = builder.parse(file.getAbsolutePath());
                    System.setProperty("org.xmldb.common.xml.queries.XPathQueryFactory", "org.xmldb.common.xml.queries.xalan2.XPathQueryFactoryImpl");

                    XPathQuery xpath = XPathQueryFactory.newInstance().newXPathQuery();
                    XUpdateQuery xq = new XUpdateQueryImpl();

                    String editSelect = null;
                    Enumeration params = request.getParameterNames();
                    while (params.hasMoreElements()) {
                        String pname = (String) params.nextElement();
                        log.debug("Parameter: " + pname + " (" + request.getParameter(pname+ ")");

                        if (editSelect == null && pname.indexOf("edit[") >= 0 && pname.endsWith("].x")) {
                            editSelect = pname.substring(5, pname.length() - 3);
                           log.debug("Edit: " + editSelect);
                        }

                        if (pname.indexOf("<xupdate:") == 0) {
                            String select = pname.substring(pname.indexOf("select") + 8);
                            select = select.substring(0, select.indexOf("\""));
                            log.debug(".act() Select Node: " + select);

                            // Check if node exists
                            xpath.setQString(select);
                            XObject result = xpath.execute(document);
                            NodeList selectionNodeList = result.nodeset();
                            if (selectionNodeList.getLength() == 0) {
                                log.warn(".act(): Node does not exist (might have been deleted during update): " + select);
                            } else {
                                String xupdateModifications = null;
View Full Code Here

  /**
   *
   */
  protected NodeList selectNewNodes(String query, Node contextNode) throws Exception {
    XPathQuery xpath = XPathQueryFactory.newInstance().newXPathQuery();
    xpath.setQString(query);
    XObject xResult = xpath.execute(contextNode);
    if (xResult.getType() != XObject.CLASS_NODESET) {
      throw new Exception("XPath leads not to a Node or NodeList !");
    }
    NodeList result = xResult.nodeset();
    return result;
View Full Code Here

                document = builder.parse(file.getAbsolutePath());
                System.setProperty(
                    "org.xmldb.common.xml.queries.XPathQueryFactory",
                    "org.xmldb.common.xml.queries.xalan2.XPathQueryFactoryImpl");

                XPathQuery xpath =
                    XPathQueryFactory.newInstance().newXPathQuery();
                XUpdateQuery xq = new XUpdateQueryImpl();

                String editSelect = null;
                Enumeration params = request.getParameterNames();
                while (params.hasMoreElements()) {
                    String pname = (String) params.nextElement();
                    log.debug(
                        "Parameter: "
                            + pname
                            + " ("
                            + request.getParameter(pname)
                            + ")");

                    // Extract the xpath to edit
                    if (editSelect == null
                        && pname.indexOf("edit[") >= 0
                        && pname.endsWith("].x")) {
                        editSelect = pname.substring(5, pname.length() - 3);
                        log.debug("Edit: " + editSelect);
                    }

                    // Make sure we are dealing with an xupdate statement, else skip
                    if (pname.indexOf("<xupdate:") == 0) {
                        String select =
                            pname.substring(pname.indexOf("select") + 8);
                        select = select.substring(0, select.indexOf("\""));
                        log.debug(".act() Select Node: " + select);

                        // Check if node exists
                        xpath.setQString(select);
                        XObject result = xpath.execute(document);
                        NodeList selectionNodeList = result.nodeset();
                        if (selectionNodeList.getLength() == 0) {
                            log.debug(
                                ".act(): Node does not exist (might have been deleted during update): "
                                    + select);
View Full Code Here

                    DocumentBuilder builder = parserFactory.newDocumentBuilder();
                    document = builder.parse(file.getAbsolutePath());
                    System.setProperty("org.xmldb.common.xml.queries.XPathQueryFactory",
                            "org.xmldb.common.xml.queries.xalan2.XPathQueryFactoryImpl");

                    XPathQuery xpath = XPathQueryFactory.newInstance().newXPathQuery();
                    XUpdateQuery xq = new XUpdateQueryImpl();

                    String editSelect = null;
                    Enumeration params = request.getParameterNames();
                    while (params.hasMoreElements()) {
                        String pname = (String) params.nextElement();
                        getLogger().debug("Parameter: " + pname + " ("
                                + request.getParameter(pname) + ")");

                        // Extract the xpath to edit
                        if (editSelect == null && pname.indexOf("edit[") >= 0
                                && pname.endsWith("].x")) {
                            editSelect = pname.substring(5, pname.length() - 3);
                            getLogger().debug("Edit: " + editSelect);
                        }

                        // Make sure we are dealing with an xupdate statement,
                        // else skip
                        if (pname.indexOf("<xupdate:") == 0) {
                            String select = pname.substring(pname.indexOf("select") + 8);
                            select = select.substring(0, select.indexOf("\""));
                            getLogger().debug(".act() Select Node: " + select);

                            // Check if node exists
                            xpath.setQString(select);
                            XObject result = xpath.execute(document);
                            NodeList selectionNodeList = result.nodeset();
                            if (selectionNodeList.getLength() == 0) {
                                getLogger()
                                        .debug(".act(): Node does not exist (might have been deleted during update): "
                                                + select);
View Full Code Here

                document = builder.parse(file.getAbsolutePath());
                System.setProperty(
                    "org.xmldb.common.xml.queries.XPathQueryFactory",
                    "org.xmldb.common.xml.queries.xalan2.XPathQueryFactoryImpl");

                XPathQuery xpath =
                    XPathQueryFactory.newInstance().newXPathQuery();
                XUpdateQuery xq = new XUpdateQueryImpl();

                String editSelect = null;
                Enumeration params = request.getParameterNames();
                while (params.hasMoreElements()) {
                    String pname = (String) params.nextElement();
                    log.debug(
                        "Parameter: "
                            + pname
                            + " ("
                            + request.getParameter(pname)
                            + ")");

                    // Extract the xpath to edit
                    if (editSelect == null
                        && pname.indexOf("edit[") >= 0
                        && pname.endsWith("].x")) {
                        editSelect = pname.substring(5, pname.length() - 3);
                        log.debug("Edit: " + editSelect);
                    }

                    // Make sure we are dealing with an xupdate statement, else skip
                    if (pname.indexOf("<xupdate:") == 0) {
                        String select =
                            pname.substring(pname.indexOf("select") + 8);
                        select = select.substring(0, select.indexOf("\""));
                        log.debug(".act() Select Node: " + select);

                        // Check if node exists
                        xpath.setQString(select);
                        XObject result = xpath.execute(document);
                        NodeList selectionNodeList = result.nodeset();
                        if (selectionNodeList.getLength() == 0) {
                            log.debug(
                                ".act(): Node does not exist (might have been deleted during update): "
                                    + select);
View Full Code Here

TOP

Related Classes of org.xmldb.common.xml.queries.XPathQuery

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.