本文整理了Java中org.dom4j.Node.selectNodes()
方法的一些代码示例,展示了Node.selectNodes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.selectNodes()
方法的具体详情如下:
包路径:org.dom4j.Node
类名称:Node
方法名:selectNodes
[英]selectNodes
evaluates an XPath expression and returns the result as a List
of Node
instances or String
instances depending on the XPath expression.
[中]selectNodes
对XPath表达式求值,并根据XPath表达式返回Node
实例或String
实例的List
结果。
代码示例来源:origin: spotbugs/spotbugs
@SuppressWarnings("unchecked")
public static <T> List<T> selectNodes(Node node, String arg0) {
return (List<T>)node.selectNodes(arg0);
}
代码示例来源:origin: igniterealtime/Openfire
private Map<String, String> readInitParams(Node configData) {
Map<String, String> paramMap = new HashMap<>();
List<Node> params = configData.selectNodes("init-params/init-param");
for (Node param : params) {
String paramName = param.selectSingleNode("param-name").getStringValue();
String paramValue = param.selectSingleNode("param-value").getStringValue();
paramMap.put(paramName, paramValue);
}
return paramMap;
}
代码示例来源:origin: com.atlassian.bamboo.plugins.dotnet/atlassian-bamboo-plugin-dotnet
@NotNull
private static Map<String, Node> cacheUnitTestNodes(final Node document, final String namespacePrefix)
{
final Map<String, Node> cachedTestInfo = new HashMap<>();
final List<Element> cachedNodes = document.selectNodes("//" + namespacePrefix + "UnitTest");
for (final Element e : cachedNodes)
{
cachedTestInfo.put(e.attributeValue("id"), e);
}
return cachedTestInfo;
}
代码示例来源:origin: org.craftercms/crafter-core
/**
* Executes the specified XPath query as a multiple node query, returning the text values of the resulting list of
* nodes.
*/
@SuppressWarnings("unchecked")
public static List<String> selectNodeValues(Node node, String xpathQuery) {
List<Node> resultNodes = node.selectNodes(xpathQuery);
return extractNodeValues(resultNodes);
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
private void evaluate(Node e, List<String> errors) {
@SuppressWarnings("unchecked")
List<Node> contexts = e.selectNodes(contextPattern);
if (contexts != null && contexts.size() > 0) {
for (Node ctxNode : contexts) {
for (RuleTest test : tests) {
test.evaluate(ctxNode, errors);
}
}
}
}
}
代码示例来源:origin: stackoverflow.com
String getAllTextContent(Node node) {
List<Node> nodes = node.selectNodes("descendant-or-self::text()");
StringBuilder buf = new StringBuilder();
for ( Node n : nodes ) {
buf.append(n.getText());
}
return buf.toString();
}
// usage
System.out.println(getAllTextContent(doc.selectSingleNode("//sentence")));
代码示例来源:origin: USPTO/PatentPublicData
private void continuationPart(Node fragmentNode) {
@SuppressWarnings("unchecked")
List<Node> continuationPartN = fragmentNode.selectNodes("continuations/continuation-in-part-of/parent-child");
for (Node continuationPart : continuationPartN) {
readIds(continuationPart, DocumentIdType.CONTINUATION_IN_PART);
}
}
代码示例来源:origin: USPTO/PatentPublicData
private void contionationOf(Node fragmentNode) {
@SuppressWarnings("unchecked")
List<Node> continuationN = fragmentNode.selectNodes("continuations/continuation-of/parent-child");
for (Node continuation : continuationN) {
readIds(continuation, DocumentIdType.CONTINUATION);
}
}
代码示例来源:origin: USPTO/PatentPublicData
private List<String> getValues(String mathMLString) {
List<String> values = new ArrayList<String>();
List<Node> textNodes = mathNode.selectNodes("//*[text()]");
for (Node node : textNodes) {
String value = node.getText().trim();
if (!value.isEmpty() && !"=".equals(value)) {
values.add(value);
}
}
return values;
}
代码示例来源:origin: pentaho/pentaho-platform
public void setPaintSequence( final Node paletteNode ) {
if ( paletteNode != null ) {
List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME );
Paint[] paints = new Paint[colorNodes.size()];
for ( int i = 0; i < colorNodes.size(); i++ ) {
paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) );
}
setPaintSequence( paints );
}
}
代码示例来源:origin: pentaho/pentaho-platform
public void setPaintSequence( final Node paletteNode ) {
if ( paletteNode != null ) {
List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME );
Paint[] paints = new Paint[colorNodes.size()];
for ( int i = 0; i < colorNodes.size(); i++ ) {
paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) );
}
setPaintSequence( paints );
}
}
代码示例来源:origin: pentaho/pentaho-platform
public void setPaintSequence( final Node paletteNode ) {
if ( paletteNode != null ) {
List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME );
Paint[] paints = new Paint[colorNodes.size()];
for ( int i = 0; i < colorNodes.size(); i++ ) {
paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) );
}
setPaintSequence( paints );
}
}
代码示例来源:origin: pentaho/pentaho-platform
public void setBarSeries( final Node barSeriesNode ) {
if ( barSeriesNode != null ) {
List barNodes = barSeriesNode.selectNodes( BarLineChartDefinition.SERIES_NODE_NAME );
String[] bars = new String[barNodes.size()];
for ( int i = 0; i < barNodes.size(); i++ ) {
Node barNode = (Node) barNodes.get( i );
bars[i] = barNode.getText();
}
setBarColumns( bars );
}
}
代码示例来源:origin: pentaho/pentaho-platform
public void setLineSeries( final Node lineSeriesNode ) {
if ( lineSeriesNode != null ) {
List lineNodes = lineSeriesNode.selectNodes( BarLineChartDefinition.SERIES_NODE_NAME );
String[] lines = new String[lineNodes.size()];
for ( int i = 0; i < lineNodes.size(); i++ ) {
Node lineNode = (Node) lineNodes.get( i );
lines[i] = lineNode.getText();
}
setLineColumns( lines );
}
}
代码示例来源:origin: pentaho/pentaho-platform
public void setPaintSequence( final Node paletteNode ) {
if ( paletteNode != null ) {
List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME );
Paint[] paints = new Paint[colorNodes.size()];
for ( int i = 0; i < colorNodes.size(); i++ ) {
paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) );
}
setPaintSequence( paints );
}
}
代码示例来源:origin: pentaho/pentaho-platform
public void setPaintSequence( final Node paletteNode ) {
if ( paletteNode != null ) {
List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME );
Paint[] paints = new Paint[colorNodes.size()];
for ( int i = 0; i < colorNodes.size(); i++ ) {
paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) );
}
setPaintSequence( paints );
}
}
代码示例来源:origin: pentaho/pentaho-platform
public void setPaintSequence( final Node paletteNode ) {
if ( paletteNode != null ) {
List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME );
Paint[] paints = new Paint[colorNodes.size()];
for ( int i = 0; i < colorNodes.size(); i++ ) {
paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) );
}
setPaintSequence( paints );
}
}
代码示例来源:origin: com.googlecode.cernunnos/cernunnos
public void perform(TaskRequest req, TaskResponse res) {
Node srcNode = (Node) source.evaluate(req, res);
List nodes = srcNode.selectNodes((String) xpath.evaluate(req, res));
String name = (String) attribute_name.evaluate(req, res);
for (Iterator it = nodes.iterator(); it.hasNext();) {
Node n = (Node) it.next();
res.setAttribute(name, n);
super.performSubtasks(req, res);
}
}
代码示例来源:origin: USPTO/PatentPublicData
public ClassificationItem parse(Document document) {
Node parentClassItemN = document.selectSingleNode("/class-scheme/classification-item");
ClassificationItem parentClassItem = readClassificationItem(parentClassItemN, null);
List<Node> childClassItems = parentClassItemN.selectNodes("classification-item");
for (Node childClass: childClassItems){
readClassificationItem(childClass, parentClassItem);
}
return parentClassItem;
}
代码示例来源:origin: USPTO/PatentPublicData
private void divisionOf(Node fragmentNode) {
@SuppressWarnings("unchecked")
List<Node> divisionalN = fragmentNode.selectNodes("division-of/parent-child");
for (Node divisional : divisionalN) {
readIds(divisional, DocumentIdType.DIVISION);
Node parentPNode = divisional.selectSingleNode("parent-patent");
if (parentPNode != null) {
DocumentId documentId = new DocumentIdNode(parentPNode).read();
relatedDocIds.add(documentId);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!