Java Utililty Methods XPath Create

List of utility methods to do XPath Create

  1. HOME
  2. Java
  3. X
  4. XPath Create

Description

The list of methods to do XPath Create are organized into topic(s).

Method

String getXmlString(Node inXml, String xpath)
get Xml String
if (!xpath.contains("/")) {
 NodeList elements = ((Element) inXml).getElementsByTagName(xpath);
 if (elements.getLength() == 1) {
 return elements.item(0).getTextContent();
try {
 return xPath.evaluate(xpath, inXml);
...
XPath getXPath()
Creates a new XPath object, without namespace context or other configuration.
return factory.newXPath();
XPath getXPath()
get X Path
XPathFactory xPathfactory = XPathFactory.newInstance();
XPath xpath = xPathfactory.newXPath();
return xpath;
XPath getXpath()
get Xpath
try {
 XPath xpath = xpathTL.get();
 if (xpath == null) {
 xpath = XPathFactory.newInstance().newXPath();
 xpathTL.set(xpath);
 return xpath;
} catch (Exception e) {
...
XPath getXPath()
Gets the XPath API, creating it if necessary.
if (xpath == null) {
 xpath = getXPathFactory().newXPath();
return xpath;
XPath getxPath()
getx Path
return xPathFactory.newXPath();
ThreadLocal getXPath()
get X Path
if (xPath == null) {
 xPath = new ThreadLocal<XPath>() {
 @Override
 protected XPath initialValue() {
 return XPathFactory.newInstance().newXPath();
 };
return xPath;
String getXPath(Element elt)
get X Path
String xpath = "";
if (elt != null) {
 Document doc = elt.getOwnerDocument();
 Element root = doc.getDocumentElement();
 Element parent = elt;
 while (parent != root) {
 xpath = "/" + parent.getNodeName() + xpath;
 parent = (Element) parent.getParentNode();
...
String getXPath(Element rootElement, Element targetElement, boolean includeElementIndex, Map namespacesMap)
Returns the XPath to retrieve targetElement from rootElement.
Stack<Element> elementPath = new Stack<Element>();
Map<String, String> namespaceUriToIdMap = new HashMap<String, String>();
for (Entry<String, String> entry : namespacesMap.entrySet()) {
 namespaceUriToIdMap.put(entry.getValue(), entry.getKey());
 Element currentElement = targetElement;
 while (currentElement != null && currentElement != rootElement) {
...
XPath getXPath(NamespaceContext nsContext)
get X Path
XPath xpath = XPathFactory.newInstance().newXPath();
if (nsContext != null)
 xpath.setNamespaceContext(nsContext);
return xpath;


AltStyle によって変換されたページ (->オリジナル) /