XPath represents an XPath expression after it has been parsed from a String.
XPath
253254255256257258259260261262263264
} public String getElementText( String xpathExpr ) throws XMLException { XPath xpath = createXPath( xpathExpr ); Object evaluated = xpath.selectSingleNode( document ); if ( evaluated == null ) { return null; }
278279280281282283284285286287288289
@SuppressWarnings("unchecked") public List<Element> getElementList( String xpathExpr ) throws XMLException { XPath xpath = createXPath( xpathExpr ); Object evaluated = xpath.evaluate( document ); if ( evaluated == null ) { return null; }
147148149150151152153154155156157158
} public Element getElement( String xpathExpr ) throws XMLException { XPath xpath = createXPath( xpathExpr ); Object evaluated = xpath.selectSingleNode( document ); if ( evaluated == null ) { return null; }
170171172173174175176177178179180181
} } private XPath createXPath( String xpathExpr ) { XPath xpath = document.createXPath( xpathExpr ); if ( !this.namespaceMap.isEmpty() ) { xpath.setNamespaceURIs( this.namespaceMap ); } return xpath; }
181182183184185186187188189190191192
} public boolean hasElement( String xpathExpr ) throws XMLException { XPath xpath = createXPath( xpathExpr ); Object evaluated = xpath.selectSingleNode( document ); if ( evaluated == null ) { return false; }
229230231232233234235236237238239240
} public String getElementText( Node context, String xpathExpr ) throws XMLException { XPath xpath = createXPath( xpathExpr ); Object evaluated = xpath.selectSingleNode( context ); if ( evaluated == null ) { return null; }
277278279280281282283284285286287288
} public List<Element> getElementList( String xpathExpr ) throws XMLException { XPath xpath = createXPath( xpathExpr ); Object evaluated = xpath.evaluate( document ); if ( evaluated == null ) { return null; }
140141142143144145146147148149150151