本文整理了Java中org.dom4j.Node.getPath()
方法的一些代码示例,展示了Node.getPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getPath()
方法的具体详情如下:
包路径:org.dom4j.Node
类名称:Node
方法名:getPath
[英]Returns the XPath expression which will return a node set containing the given node such as /a/b/@c. No indexing will be used to restrict the path if multiple elements with the same name occur on the path.
[中]返回XPath表达式,该表达式将返回包含给定节点(如/a/b/@c)的节点集。如果路径上出现多个同名元素,则不会使用索引来限制路径。
代码示例来源:origin: pentaho/pentaho-kettle
private void addLoopXPath( Node node, IProgressMonitor monitor ) {
Element ce = (Element) node;
monitor.worked( 1 );
// List child
for ( int j = 0; j < ce.nodeCount(); j++ ) {
if ( monitor.isCanceled() ) {
return;
}
Node cnode = ce.node( j );
if ( !Utils.isEmpty( cnode.getName() ) ) {
Element cce = (Element) cnode;
if ( !listpath.contains( cnode.getPath() ) ) {
nr++;
monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.FetchNodes",
String.valueOf( nr ) ) );
monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.AddingNode",
cnode.getPath() ) );
listpath.add( cnode.getPath() );
}
// let's get child nodes
if ( cce.nodeCount() > 1 ) {
addLoopXPath( cnode, monitor );
}
}
}
}
代码示例来源:origin: pentaho/pentaho-kettle
return null;
if ( !listpath.contains( node.getPath() ) ) {
nr++;
monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.FetchNodes",
String.valueOf( nr ) ) );
monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.AddingNode", node
.getPath() ) );
listpath.add( node.getPath() );
addLoopXPath( node, monitor );
代码示例来源:origin: pentaho/pentaho-kettle
.valueOf( nr ) ) );
monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.FetchNodes", node
.getPath() ) );
setNodeField( node, monitor );
childNode( node, monitor );
代码示例来源:origin: pentaho/pentaho-kettle
String nodenametxt = cleanString( node.getPath() );
代码示例来源:origin: quickfix-j/quickfixj
private String getSingleNodeTextSafe(Node node, String tag) {
Node nodeWithTag = node.selectSingleNode(tag);
if(nodeWithTag != null)
return nodeWithTag.getText();
else
throw new RuntimeException("Node with tag "+tag+" not found in "+node.getPath());
}
代码示例来源:origin: org.quickfixj/quickfixj-all
private String getSingleNodeTextSafe(Node node, String tag) {
Node nodeWithTag = node.selectSingleNode(tag);
if(nodeWithTag != null)
return nodeWithTag.getText();
else
throw new RuntimeException("Node with tag "+tag+" not found in "+node.getPath());
}
代码示例来源:origin: org.quickfixj/quickfixj-dictgenerator
private String getSingleNodeTextSafe(Node node, String tag) {
Node nodeWithTag = node.selectSingleNode(tag);
if(nodeWithTag != null)
return nodeWithTag.getText();
else
throw new RuntimeException("Node with tag "+tag+" not found in "+node.getPath());
}
代码示例来源:origin: dom4j/dom4j
protected void testNodePath(Node node) {
String path = node.getPath();
log("Path: " + path + " node: " + node);
}
}
代码示例来源:origin: gradle.plugin.org.jamgo/eclipselink-plugin
private void createTemporaryPersistenceInfo(List<String> entityClassNames) throws DocumentException, IOException {
SAXReader reader = new SAXReader();
Document persistenceXmlDocument = reader.read(Resources.asCharSource(Resources.getResource("empty-persistence.xml"), Charsets.UTF_8).openStream());
Node persistenceUnitNode = persistenceXmlDocument.selectSingleNode("//*[name()='persistence-unit']");
this.logger.debug(persistenceUnitNode.getPath());
if (persistenceUnitNode != null) {
this.logger.debug("persistence-unit found");
for (String eachEntityClassName : entityClassNames) {
Element classElement = ((Element) persistenceUnitNode).addElement("class");
classElement.setText(eachEntityClassName);
}
}
GFileUtils.mkdirs(new File(this.getTemporaryDir().getAbsolutePath() + "/META-INF"));
File temporaryPersistenceInfoFile = new File(this.getTemporaryDir().getAbsolutePath() + "/META-INF/persistence.xml");
Writer writer = new FileWriter(temporaryPersistenceInfoFile);
OutputFormat format = OutputFormat.createPrettyPrint();
XMLWriter xmlWriter = new XMLWriter(writer, format);
xmlWriter.write(persistenceXmlDocument);
xmlWriter.close();
}
代码示例来源:origin: pentaho/pentaho-platform
Node node = (Node) nodeIterator.next();
String name = node.getText();
if ( name.startsWith( "%" ) && !node.getPath().endsWith( "/text()" ) ) { //$NON-NLS-1$ //$NON-NLS-2$
try {
String localeText = getLocaleString( name, baseName, file, true );
代码示例来源:origin: dom4j/dom4j
protected void testPath(Node node, String path, String uniquePath) {
assertEquals("getPath expression should be what is expected", path,
node.getPath());
assertEquals("getUniquePath expression should be what is expected",
uniquePath, node.getUniquePath());
}
代码示例来源:origin: dom4j/dom4j
protected void testRelativePath(Element context, Node node, String pathRel,
String uniquePathRel) {
assertEquals("relative getPath expression should be what is expected",
pathRel, node.getPath(context));
assertEquals("relative getUniquePath expression not correct",
uniquePathRel, node.getUniquePath(context));
}
内容来源于网络,如有侵权,请联系作者删除!