List of usage examples for org.w3c.dom Node getTextContent
public String getTextContent() throws DOMException;
From source file:co.edu.uniajc.vtf.utils.GMapV2Direction.java
public String getDurationText(Document doc) { NodeList nl1 = doc.getElementsByTagName("duration"); Node node1 = nl1.item(0);/*w w w .java 2 s .c om*/ NodeList nl2 = node1.getChildNodes(); Node node2 = nl2.item(getNodeIndex(nl2, "text")); Log.i("DurationText", node2.getTextContent()); return node2.getTextContent(); }
From source file:co.edu.uniajc.vtf.utils.GMapV2Direction.java
public String getDistanceText(Document doc) { NodeList nl1 = doc.getElementsByTagName("distance"); Node node1 = nl1.item(0);//from ww w . j a v a2s.co m NodeList nl2 = node1.getChildNodes(); Node node2 = nl2.item(getNodeIndex(nl2, "text")); Log.i("DistanceText", node2.getTextContent()); return node2.getTextContent(); }
From source file:de.betterform.xml.xforms.action.MessageAction.java
private String evaluateMessageContent() throws XFormsException { String message = ""; if (this.element.hasChildNodes()) { NodeList childNodes = this.element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); switch (node.getNodeType()) { case Node.TEXT_NODE: message += node.getTextContent(); break; case Node.ELEMENT_NODE: Element element = (Element) node; Object userData = element.getUserData(""); if ((userData != null) && userData instanceof Output) { Output output = (Output) userData; message += (String) output.computeValueAttribute(); }//from w w w .ja va2s .c o m break; } } } return message; }
From source file:com.trifork.batchcopy.client.BatchCopyClient.java
private String extractLastToken(Node atomFeedNode) { // <atom:feed .. // <atom:id> .. // <atom:updated> .. // <atom:title> .. // <atom:author> .. // <atom:entry> .. // .../*from www .j a v a 2 s . com*/ // <atom:entry> // <atom:id>tag:nsi.dk,2011:doseringsforslag/dosageunit/v1/13709460140000000001</atom:id> // |- Sidste del af ovenstende ID er det offset vi skal sende med i nste request // ... // </atom:entry> NodeList childNodes = atomFeedNode.getLastChild().getChildNodes(); for (int i = 0; i < childNodes.getLength(); ++i) { Node currentChild = childNodes.item(i); if (currentChild.getLocalName().equals("id")) { String completeId = currentChild.getTextContent(); return completeId.substring(completeId.lastIndexOf("/") + 1); } } return null; }
From source file:co.edu.uniajc.vtf.utils.GMapV2Direction.java
public int getDurationValue(Document doc) { NodeList nl1 = doc.getElementsByTagName("duration"); Node node1 = nl1.item(0);/*from w w w .j a v a 2 s.co m*/ NodeList nl2 = node1.getChildNodes(); Node node2 = nl2.item(getNodeIndex(nl2, "value")); Log.i("DurationValue", node2.getTextContent()); return Integer.parseInt(node2.getTextContent()); }
From source file:co.edu.uniajc.vtf.utils.GMapV2Direction.java
public int getDistanceValue(Document doc) { NodeList nl1 = doc.getElementsByTagName("distance"); Node node1 = nl1.item(0);//w w w . jav a 2 s . co m NodeList nl2 = node1.getChildNodes(); Node node2 = nl2.item(getNodeIndex(nl2, "value")); Log.i("DistanceValue", node2.getTextContent()); return Integer.parseInt(node2.getTextContent()); }
From source file:com.example.apis.ifashion.WOEIDUtils.java
private String getFirstMatchingWOEID(Document srcDoc) { YahooWeatherLog.d("get first matching WOEID"); try {/*from w ww .j a v a 2 s.co m*/ mParsedResult = new HashMap<String, String>(); for (int i = 1; i <= 4; i++) { String name = "line" + i; parseLocationLines(srcDoc, name); } NodeList nodeListDescription = srcDoc.getElementsByTagName("woeid"); if (nodeListDescription.getLength() > 0) { Node node = nodeListDescription.item(0); return node.getTextContent(); } else { return WOEID_NOT_FOUND; } } catch (Exception e) { e.printStackTrace(); return WOEID_NOT_FOUND; } }
From source file:info.androidhive.androidsplashscreentimer.WOEIDUtils.java
private String getFirstMatchingWOEID(Document srcDoc) { MyLog.d("get first matching WOEID"); try {//from w ww . j a va 2 s . c om mParsedResult = new HashMap<String, String>(); for (int i = 1; i <= 4; i++) { String name = "line" + i; parseLocationLines(srcDoc, name); } NodeList nodeListDescription = srcDoc.getElementsByTagName("woeid"); if (nodeListDescription.getLength() > 0) { Node node = nodeListDescription.item(0); return node.getTextContent(); } else { return WOEID_NOT_FOUND; } } catch (Exception e) { e.printStackTrace(); return WOEID_NOT_FOUND; } }
From source file:ali.arshad.soomro.aonawaredistservicesdk.AonawareDictServiceUtils.java
private String getNodeText(Node node) throws NoSuchMethodException { String string = ""; string = node.getTextContent(); return (string); }
From source file:it.geosolutions.geobatch.migrationmonitor.statuschecker.CheckerAction.java
@Override public Queue<FileSystemEvent> execute(Queue<FileSystemEvent> arg0) throws ActionException { // return object final Queue<FileSystemEvent> outputEvents = new LinkedList<FileSystemEvent>(); try {// w ww . j ava 2 s . co m //gather the input file in order to read the database table name File flowTempDirectory = new File(getTempDir().getParent()); File[] files = flowTempDirectory.listFiles(); File inputEventFile = null; if (files != null && files.length > 0) { for (File f : files) { if (f.isFile() && f.getName().endsWith(".xml")) { inputEventFile = f; } } } else { throw new Exception("One file, type xml, is expected in the root of the temp directory"); } // set as the action output event the flow input event FileSystemEvent fse = new FileSystemEvent(inputEventFile, FileSystemEventType.FILE_ADDED); outputEvents.add(fse); //parse the xml file and get the table name String tableName = ""; String host = ""; String db = ""; String schema = ""; try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder; dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(inputEventFile); doc.getDocumentElement().normalize(); NodeList nodes = doc.getElementsByTagName("typeName"); if (nodes == null || nodes.getLength() != 1) { throw new Exception( "more than one typeName has been found in the input event... this is not possible..."); } Node n = nodes.item(0); tableName = n.getTextContent(); NodeList entries = doc.getElementsByTagName("entry"); host = extractEntry("server", entries); if (host == null) { host = extractEntry("host", entries); } db = extractEntry("instance", entries); if (db == null) { db = extractEntry("database", entries); } schema = extractEntry("schema", entries); LOGGER.info("Changing state to MIGRATED for records with: server_ip:'" + host + "' db:'" + db + "' schema_nome:'" + schema + "' tabella:'" + tableName + "'"); } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw new Exception("Error while parsing input file... exception message: " + e.getMessage()); } LOGGER.info("The table name is: " + tableName); //change the status in the strati_rif table MigrationMonitor mm = migrationMonitorDAO.findByTablename(host, db, schema, tableName); mm.setMigrationStatus(MigrationStatus.MIGRATED.toString().toUpperCase()); migrationMonitorDAO.merge(mm); } catch (Exception t) { final String message = "CheckerAction::execute(): " + t.getLocalizedMessage(); if (LOGGER.isErrorEnabled()) LOGGER.error(message, t); final ActionException exc = new ActionException(this, message, t); listenerForwarder.failed(exc); throw exc; } return outputEvents; }