public T remove ( final CharSequence xpath ) { if ( ( xpath == null ) || ( xpath . length ( ) == 0 ) ) { throw new IllegalArgumentException ( "Parameter path must not be empty or null" ) ; } domChangeTracker . refreshForReadIfNeeded ( ) ; final Document document = DOMHelper . getOwnerDocumentFor ( baseNode ) ; final DuplexExpression duplexExpression = new DuplexXPathParser ( invocationContext . getProjector ( ) . config ( ) . getUserDefinedNamespaceMapping ( ) ) . compile ( xpath ) ; try { final XPathExpression expression = invocationContext . getProjector ( ) . config ( ) . createXPath ( document ) . compile ( duplexExpression . getExpressionAsStringWithoutFormatPatterns ( ) ) ; Node prevNode = ( Node ) expression . evaluate ( boundNode , XPathConstants . NODE ) ; if ( prevNode == null ) { return null ; } final T value = DefaultXPathEvaluator . convertToComponentType ( invocationContext , prevNode , invocationContext . getTargetComponentType ( ) ) ; duplexExpression . deleteAllMatchingChildren ( prevNode . getParentNode ( ) ) ; return value ; } catch ( XPathExpressionException e ) { throw new XBPathException ( e , xpath ) ; } }
Remove element at relative location .