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 ); } } } }
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 );
.valueOf( nr ) ) ); monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.FetchNodes", node .getPath() ) ); setNodeField( node, monitor ); childNode( node, monitor );
String nodenametxt = cleanString( node.getPath() );
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()); }
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()); }
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()); }
protected void testNodePath(Node node) { String path = node.getPath(); log("Path: " + path + " node: " + node); } }
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(); }
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 );
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()); }
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)); }