Java XPath Expression isLegalXPath(final String xPath)

Here you can find the source of isLegalXPath(final String xPath)

Description

is Legal X Path

License

Open Source License

Parameter

Parameter Description
xPath a parameter

Exception

Parameter Description
Exception - if path invalid.

Declaration

public static void isLegalXPath(final String xPath) throws Exception 

Method Source Code

//package com.java2s;
/*//  www  . j a va  2 s  .  c  o m
 * Copyright (c) 2012 European Synchrotron Radiation Facility,
 *                    Diamond Light Source Ltd.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

import javax.xml.xpath.XPath;

import javax.xml.xpath.XPathFactory;

public class Main {
    /**
     * 
     * @param xPath
     * @throws Exception - if path invalid.
     */
    public static void isLegalXPath(final String xPath) throws Exception {
        XPathFactory factory = XPathFactory.newInstance();
        XPath xpath = factory.newXPath();
        xpath.compile(xPath);
    }
}

Related

  1. extractNodeList(XPath xpath, String nodePath, String xmlString)
  2. extractNodes(File xmlFile, String xpathLocator)
  3. extractValue(String xml, String xpathExpression)
  4. findElements(final String xPathExpression, final Element root)
  5. hasAnimatedPng(ImageReader reader)
  6. isValidFilter(String xPathString)
  7. isXPathAbsolute(String path)
  8. loadFromXmlNode(String xmlFile, String prefix)
  9. loadNodeList(String file, String path)