List of usage examples for java.util.regex Pattern DOTALL
int DOTALL
To view the source code for java.util.regex Pattern DOTALL.
Click Source Link
From source file:org.silverpeas.components.kmelia.export.ODTDocumentBuilder.java
private void buildWithXMLText(final KmeliaPublication publication, final TextDocument odtDocument) throws Exception { boolean removeSection = true; String templateId = publication.getDetail().getInfoId(); if (!isInteger(templateId)) { PublicationTemplate template = PublicationTemplateManager.getInstance() .getPublicationTemplate(publication.getPk().getInstanceId() + ":" + templateId); Form viewForm = template.getViewForm(); RecordSet recordSet = template.getRecordSet(); DataRecord dataRecord = recordSet.getRecord(publication.getPk().getId(), getLanguage()); if (dataRecord == null) { dataRecord = recordSet.getEmptyRecord(); dataRecord.setId(publication.getPk().getId()); }//from w ww.j ava2 s .c o m PagesContext context = new PagesContext(); context.setRenderingContext(RenderingContext.EXPORT); context.setLanguage(getLanguage()); context.setComponentId(publication.getPk().getInstanceId()); context.setObjectId(publication.getPk().getId()); context.setBorderPrinted(false); context.setContentLanguage(getLanguage()); context.setUserId(getUser().getId()); context.setNodeId(getTopicIdOf(publication)); String htmlText = viewForm.toString(context, dataRecord); if (isDefined(htmlText)) { //Suppress script tag htmlText = Pattern .compile("<script[^>]*>.*?</script>", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.DOTALL) .matcher(htmlText).replaceAll(""); buildWithHTMLText(htmlText, in(odtDocument)); removeSection = false; } } if (removeSection) { Section contentSection = odtDocument.getSectionByName(SECTION_CONTENT); contentSection.remove(); } }
From source file:edu.harvard.i2b2.crc.dao.setfinder.querybuilder.temporal.TemporalSubQuery.java
private String addToRegExExpression(String sqlString, String regEx, String newSql) { StringBuilder sql = new StringBuilder(); Pattern p = Pattern.compile(regEx, Pattern.DOTALL | Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(sqlString); int lastIndex = 0; while (m.find()) { int endIndex = m.end(); String text = sqlString.substring(lastIndex, endIndex - getSqlDelimiter().length()); sql.append(text);//from w w w.ja v a 2 s .com sql.append(newSql); sql.append(getSqlDelimiter()); lastIndex = endIndex; } sql.append(sqlString.substring(lastIndex)); return sql.toString(); }
From source file:com.google.dart.tools.update.core.internal.UpdateUtils.java
private static List<Revision> parseRevisions(String urlString) throws IOException { String str = readUrlStream(urlString); Pattern linkPattern = Pattern.compile("<a[^>]+href=[\"']?([\"'>]+)[\"']?[^>]*>(.+?)</a>", Pattern.CASE_INSENSITIVE | Pattern.DOTALL); Matcher matcher = linkPattern.matcher(str); ArrayList<Revision> revisions = new ArrayList<Revision>(); while (matcher.find()) { if (matcher.group(0).contains("dart-editor-archive")) { String revision = matcher.group(2); //drop trailing slash revision = revision.replace("/", ""); //drop symbolic links (like "latest") if (isNumeric(revision)) { revisions.add(Revision.forValue(revision)); }//from www .j a v a 2 s . c o m } } return revisions; }
From source file:org.opennms.netmgt.collectd.HttpCollector.java
private static List<HttpCollectionAttribute> processResponse(final Locale responseLocale, final String responseBodyAsString, final HttpCollectionSet collectionSet, HttpCollectionResource collectionResource) { LOG.debug("processResponse:"); LOG.debug("responseBody = {}", responseBodyAsString); LOG.debug("getmatches = {}", collectionSet.getUriDef().getUrl().getMatches()); List<HttpCollectionAttribute> butes = new LinkedList<HttpCollectionAttribute>(); int flags = 0; if (collectionSet.getUriDef().getUrl().getCanonicalEquivalence()) { flags |= Pattern.CANON_EQ; }/*from w w w .j a v a 2s.c om*/ if (collectionSet.getUriDef().getUrl().getCaseInsensitive()) { flags |= Pattern.CASE_INSENSITIVE; } if (collectionSet.getUriDef().getUrl().getComments()) { flags |= Pattern.COMMENTS; } if (collectionSet.getUriDef().getUrl().getDotall()) { flags |= Pattern.DOTALL; } if (collectionSet.getUriDef().getUrl().getLiteral()) { flags |= Pattern.LITERAL; } if (collectionSet.getUriDef().getUrl().getMultiline()) { flags |= Pattern.MULTILINE; } if (collectionSet.getUriDef().getUrl().getUnicodeCase()) { flags |= Pattern.UNICODE_CASE; } if (collectionSet.getUriDef().getUrl().getUnixLines()) { flags |= Pattern.UNIX_LINES; } LOG.debug("flags = {}", flags); Pattern p = Pattern.compile(collectionSet.getUriDef().getUrl().getMatches(), flags); Matcher m = p.matcher(responseBodyAsString); final boolean matches = m.matches(); if (matches) { LOG.debug("processResponse: found matching attributes: {}", matches); final List<Attrib> attribDefs = collectionSet.getUriDef().getAttributes().getAttribCollection(); final AttributeGroupType groupType = new AttributeGroupType(collectionSet.getUriDef().getName(), AttributeGroupType.IF_TYPE_ALL); final List<Locale> locales = new ArrayList<Locale>(); if (responseLocale != null) { locales.add(responseLocale); } locales.add(Locale.getDefault()); if (Locale.getDefault() != Locale.ENGLISH) { locales.add(Locale.ENGLISH); } for (final Attrib attribDef : attribDefs) { final String type = attribDef.getType(); String value = null; try { value = m.group(attribDef.getMatchGroup()); } catch (final IndexOutOfBoundsException e) { LOG.error( "IndexOutOfBoundsException thrown while trying to find regex group, your regex does not contain the following group index: {}", attribDef.getMatchGroup()); LOG.error("Regex statement: {}", collectionSet.getUriDef().getUrl().getMatches()); continue; } if (!type.matches("^([Oo](ctet|CTET)[Ss](tring|TRING))|([Ss](tring|TRING))$")) { Number num = null; for (final Locale locale : locales) { try { num = NumberFormat.getNumberInstance(locale).parse(value); LOG.debug("processResponse: found a parsable number with locale \"{}\".", locale); break; } catch (final ParseException e) { LOG.warn( "attribute {} failed to match a parsable number with locale \"{}\"! Matched \"{}\" instead.", attribDef.getAlias(), locale, value); } } if (num == null) { LOG.warn("processResponse: gave up attempting to parse numeric value, skipping group {}", attribDef.getMatchGroup()); continue; } final HttpCollectionAttribute bute = new HttpCollectionAttribute(collectionResource, new HttpCollectionAttributeType(attribDef, groupType), num); LOG.debug("processResponse: adding found numeric attribute: {}", bute); butes.add(bute); } else { HttpCollectionAttribute bute = new HttpCollectionAttribute(collectionResource, new HttpCollectionAttributeType(attribDef, groupType), value); LOG.debug("processResponse: adding found string attribute: {}", bute); butes.add(bute); } } } else { LOG.debug("processResponse: found matching attributes: {}", matches); } return butes; }
From source file:br.com.capanema.kers.velocity.util.BuildManagerUtil.java
/** * Increment source code of filePath using template fragment. * /*from w ww . j av a2 s.c o m*/ * @param filePath * @param incrementPath * @param incrementPattern * @param dataGroup */ public static void incrementSourceCode(String filePath, String incrementPath, String incrementPattern, String firstAfter, Map<String, String> params, TemplateDataGroup dataGroup) { try { HashMap<String, Object> velocityVariables = new HashMap<String, Object>(); //map for velocity variables velocityVariables.put("data", dataGroup); //conjunto de vriaveis que podem ser usados no template if (params != null && params.size() > 0) { /* for (String name : params.keySet()) { velocityVariables.put("params."+name, params.get(name)); }*/ velocityVariables.put("params", params); } //rodando velocity do incremento TemplateEngine templateEngine = TemplateEngineFactory.getEngine(incrementPath, true); String incrementSource = templateEngine.runFile(incrementPath, velocityVariables); // Create the pattern Pattern pattern = Pattern.compile("[\r\n]*[\t]*" + incrementPattern, Pattern.DOTALL); //o "[\r\n]*" para pegar as quebras de linhas que podem existir no incremento Matcher matcher = pattern.matcher(""); //novo incremento //aqui vai executar o pattern no prprio incremento... se o pattern estiver errado no ir encontrar nada e vai abortar o incremento matcher.reset(incrementSource); Map<String, String[]> mapGroupIncrement = new LinkedHashMap<String, String[]>(); while (matcher.find()) { String[] groups = new String[matcher.groupCount()]; for (int i = 0; i < matcher.groupCount(); i++) { groups[i] = matcher.group(i + 1); } String increment = matcher.group(); //new increment mapGroupIncrement.put(increment, groups); //map increment vs groups } if (mapGroupIncrement.size() == 0) { //no encontrou groups no incremento (usado para as comparaes), aborta return; } //le o arquivo atual FileInputStream inputFilePath = new FileInputStream(filePath); BufferedInputStream bufferedInput = new BufferedInputStream(inputFilePath); StringBuffer filePathContent = new StringBuffer(); int ch = 0; while ((ch = bufferedInput.read()) > -1) { filePathContent.append((char) ch); } inputFilePath.close(); bufferedInput.close(); //procura no arquivo todo pela expresso regular matcher = pattern.matcher(""); matcher.reset(filePathContent); StringBuffer newContentFile = new StringBuffer(); int countMatcher = 0; Map<String, String[]> mapGroupFile = new HashMap<String, String[]>(); while (matcher.find()) { //verifica cada ocorrncia da expresso no arquivo String[] groups = new String[matcher.groupCount()]; //pega os groups "()" do matcher para fazer a comparao com os groups do incremento que est sendo gerado for (int i = 0; i < matcher.groupCount(); i++) { groups[i] = matcher.group(i + 1); } mapGroupFile.put(matcher.group(), groups); //adiciona esse group em uma lista para ser avaliado depois countMatcher++; //isso vai contar onde esta o ltimo matcher } //valida quais incrementos so realmente novos, comparando os groups List<String> newIncrements = new LinkedList<String>(); for (String groupIncrement : mapGroupIncrement.keySet()) { String[] groups1 = mapGroupIncrement.get(groupIncrement); //groups do incremento boolean itemFound = false; for (String groupFile : mapGroupFile.keySet()) { String[] groups2 = mapGroupFile.get(groupFile); //groups do incremento if (ArrayUtil.equals(groups1, groups2)) { //se no arquivo tem o cdigo que est sendo gerado, no precisa adicionar esse incremnto itemFound = true; } } if (!itemFound) { //se no arquivo no tem o cdigo que est sendo gerado, adiciona em um array newIncrements.add(groupIncrement); } } //realiza uma quebra de linha adicional para o primeiro item do incremento, para no ficar na mesma linha do ltimo matcher no arquivo StringBuffer newIncrementSource = new StringBuffer(); int i = 0; for (String incremento : newIncrements) { if (i == 0 && incremento.indexOf("\r\n\r\n") != 0) { //s coloca quebra de linha se precisar newIncrementSource.append("\r\n"); } newIncrementSource.append(incremento); i++; } if (newIncrements.size() > 0) { //no encontrou nenhum increment no arquivo, ento procura pelo firstAfter para inserir o primeiro incremento if (countMatcher == 0 && firstAfter != null && !firstAfter.equals("")) { pattern = Pattern.compile(firstAfter, Pattern.DOTALL); matcher = pattern.matcher(""); matcher.reset(filePathContent); //esse loop s serviu para contar e achar o ltimo matcher. No consegui fazer sem isso :( countMatcher = 0; while (matcher.find()) { //verifica cada ocorrncia da expresso countMatcher++; } } //aqui vou realmente substituir os valores, j sabendo qual a ltima ocorrencia da palavra no arquivo i = 0; matcher.reset(); while (matcher.find()) { //verifica cada ocorrncia da expresso i++; if (countMatcher == i) { //se encontrou a ltima ocorrencia String matcherGroup = matcher.group(); matcher.appendReplacement(newContentFile, matcherGroup + newIncrementSource); //substitui a ultima ocorrencia do firstIncrement } } matcher.appendTail(newContentFile); } //save new file if (newContentFile.length() > 0) { FileUtil.writeFile(filePath, newContentFile.toString()); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } }
From source file:io.selendroid.standalone.builder.SelendroidServerBuilder.java
private static String getVersionFromPom(String path) throws Exception { path += "pom.xml"; Pattern regex = Pattern.compile("<version>(.*?)</version>", Pattern.DOTALL); Matcher matcher = regex.matcher(FileUtils.readFileToString(new File(path))); if (matcher.find()) { return matcher.group(1); } else/*from w w w . j a v a2 s. c o m*/ return "dev"; }
From source file:org.kie.server.integrationtests.shared.KieServerBaseIntegrationTest.java
protected static void assertResultContainsStringRegex(String result, String regex) { assertTrue("Regex '" + regex + "' does not matches result string '" + result + "'!", Pattern.compile(regex, Pattern.DOTALL).matcher(result).matches()); }
From source file:org.apache.asterix.test.common.TestExecutor.java
public void runScriptAndCompareWithResultRegex(File scriptFile, File expectedFile, File actualFile) throws Exception { System.err.println("Expected results file: " + expectedFile.toString()); String lineExpected, lineActual; try (BufferedReader readerExpected = new BufferedReader( new InputStreamReader(new FileInputStream(expectedFile), "UTF-8")); BufferedReader readerActual = new BufferedReader( new InputStreamReader(new FileInputStream(actualFile), "UTF-8"))) { StringBuilder actual = new StringBuilder(); while ((lineActual = readerActual.readLine()) != null) { actual.append(lineActual).append('\n'); }/*from w ww .j a v a 2 s . c o m*/ while ((lineExpected = readerExpected.readLine()) != null) { if ("".equals(lineExpected.trim())) { continue; } Matcher m = REGEX_LINES_PATTERN.matcher(lineExpected); if (!m.matches()) { throw new IllegalArgumentException( "Each line of regex file must conform to: [-]/regex/[flags]: " + expectedFile); } String negateStr = m.group(1); String expression = m.group(2); String flagStr = m.group(3); boolean negate = "-".equals(negateStr); int flags = Pattern.MULTILINE; if (flagStr.contains("m")) { flags |= Pattern.DOTALL; } if (flagStr.contains("i")) { flags |= Pattern.CASE_INSENSITIVE; } Pattern linePattern = Pattern.compile(expression, flags); boolean match = linePattern.matcher(actual).find(); if (match && !negate || negate && !match) { continue; } throw new Exception("Result for " + scriptFile + ": expected pattern '" + expression + "' not found in result."); } } catch (Exception e) { System.err.println("Actual results file: " + actualFile.toString()); throw e; } }
From source file:ch.fixme.status.Main.java
private void populateDataHs() { try {//from w w w . java 2 s . co m HashMap<String, Object> data = new ParseGeneric(mResultHs).getData(); // Initialize views LayoutInflater inflater = getLayoutInflater(); LinearLayout vg = (LinearLayout) inflater.inflate(R.layout.base, null); ScrollView scroll = (ScrollView) findViewById(R.id.scroll); scroll.removeAllViews(); scroll.addView(vg); // Mandatory fields ((TextView) findViewById(R.id.space_name)).setText((String) data.get(ParseGeneric.API_NAME)); ((TextView) findViewById(R.id.space_url)).setText((String) data.get(ParseGeneric.API_URL)); getImageTask = new GetImage(R.id.space_image); getImageTask.execute((String) data.get(ParseGeneric.API_LOGO)); // Status text String status_txt = ""; if ((Boolean) data.get(ParseGeneric.API_STATUS)) { status_txt = OPEN; ((TextView) findViewById(R.id.status_txt)) .setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.presence_online, 0, 0, 0); } else { status_txt = CLOSED; ((TextView) findViewById(R.id.status_txt)) .setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.presence_busy, 0, 0, 0); } if (data.containsKey(ParseGeneric.API_STATUS_TXT)) { status_txt += ": " + (String) data.get(ParseGeneric.API_STATUS_TXT); } ((TextView) findViewById(R.id.status_txt)).setText(status_txt); // Status last change if (data.containsKey(ParseGeneric.API_LASTCHANGE)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setAutoLinkMask(0); tv.setText( getString(R.string.api_lastchange) + " " + (String) data.get(ParseGeneric.API_LASTCHANGE)); vg.addView(tv); } // Status duration if (data.containsKey(ParseGeneric.API_EXT_DURATION) && (Boolean) data.get(ParseGeneric.API_STATUS)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setText(getString(R.string.api_duration) + " " + (String) data.get(ParseGeneric.API_EXT_DURATION) + getString(R.string.api_duration_hours)); vg.addView(tv); } // Location Pattern ptn = Pattern.compile("^.*$", Pattern.DOTALL); if (data.containsKey(ParseGeneric.API_ADDRESS) || data.containsKey(ParseGeneric.API_LON)) { TextView title = (TextView) inflater.inflate(R.layout.title, null); title.setText(getString(R.string.api_location)); vg.addView(title); inflater.inflate(R.layout.separator, vg); // Address if (data.containsKey(ParseGeneric.API_ADDRESS)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setAutoLinkMask(0); tv.setText((String) data.get(ParseGeneric.API_ADDRESS)); Linkify.addLinks(tv, ptn, MAP_SEARCH); vg.addView(tv); } // Lon/Lat if (data.containsKey(ParseGeneric.API_LON) && data.containsKey(ParseGeneric.API_LAT)) { String addr = (data.containsKey(ParseGeneric.API_ADDRESS)) ? (String) data.get(ParseGeneric.API_ADDRESS) : getString(R.string.empty); TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setAutoLinkMask(0); tv.setText((String) data.get(ParseGeneric.API_LON) + ", " + (String) data.get(ParseGeneric.API_LAT)); Linkify.addLinks(tv, ptn, String.format(MAP_COORD, (String) data.get(ParseGeneric.API_LAT), (String) data.get(ParseGeneric.API_LON), addr)); vg.addView(tv); } } // Contact if (data.containsKey(ParseGeneric.API_PHONE) || data.containsKey(ParseGeneric.API_TWITTER) || data.containsKey(ParseGeneric.API_IRC) || data.containsKey(ParseGeneric.API_EMAIL) || data.containsKey(ParseGeneric.API_ML)) { TextView title = (TextView) inflater.inflate(R.layout.title, null); title.setText(R.string.api_contact); vg.addView(title); inflater.inflate(R.layout.separator, vg); // Phone if (data.containsKey(ParseGeneric.API_PHONE)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setText((String) data.get(ParseGeneric.API_PHONE)); vg.addView(tv); } // SIP if (data.containsKey(ParseGeneric.API_SIP)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setText((String) data.get(ParseGeneric.API_SIP)); vg.addView(tv); } // Twitter if (data.containsKey(ParseGeneric.API_TWITTER)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setText(TWITTER + (String) data.get(ParseGeneric.API_TWITTER)); vg.addView(tv); } // Identica if (data.containsKey(ParseGeneric.API_IDENTICA)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setText((String) data.get(ParseGeneric.API_IDENTICA)); vg.addView(tv); } // Foursquare if (data.containsKey(ParseGeneric.API_FOURSQUARE)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setText(FOURSQUARE + (String) data.get(ParseGeneric.API_FOURSQUARE)); vg.addView(tv); } // IRC if (data.containsKey(ParseGeneric.API_IRC)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setAutoLinkMask(0); tv.setText((String) data.get(ParseGeneric.API_IRC)); vg.addView(tv); } // Email if (data.containsKey(ParseGeneric.API_EMAIL)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setText((String) data.get(ParseGeneric.API_EMAIL)); vg.addView(tv); } // Jabber if (data.containsKey(ParseGeneric.API_JABBER)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setText((String) data.get(ParseGeneric.API_JABBER)); vg.addView(tv); } // Mailing-List if (data.containsKey(ParseGeneric.API_ML)) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setText((String) data.get(ParseGeneric.API_ML)); vg.addView(tv); } } // Sensors if (data.containsKey(ParseGeneric.API_SENSORS)) { // Title TextView title = (TextView) inflater.inflate(R.layout.title, null); title.setText(getString(R.string.api_sensors)); vg.addView(title); inflater.inflate(R.layout.separator, vg); HashMap<String, ArrayList<HashMap<String, String>>> sensors = (HashMap<String, ArrayList<HashMap<String, String>>>) data .get(ParseGeneric.API_SENSORS); Set<String> names = sensors.keySet(); Iterator<String> it = names.iterator(); while (it.hasNext()) { String name = it.next(); // Subtitle String name_title = name.toLowerCase().replace("_", " "); name_title = name_title.substring(0, 1).toUpperCase() + name_title.substring(1, name_title.length()); TextView subtitle = (TextView) inflater.inflate(R.layout.subtitle, null); subtitle.setText(name_title); vg.addView(subtitle); // Sensors data ArrayList<HashMap<String, String>> sensorsData = sensors.get(name); for (HashMap<String, String> elem : sensorsData) { RelativeLayout rl = (RelativeLayout) inflater.inflate(R.layout.entry_sensor, null); if (elem.containsKey(ParseGeneric.API_VALUE)) { ((TextView) rl.findViewById(R.id.entry_value)) .setText(elem.get(ParseGeneric.API_VALUE)); } else { rl.findViewById(R.id.entry_value).setVisibility(View.GONE); } if (elem.containsKey(ParseGeneric.API_UNIT)) { ((TextView) rl.findViewById(R.id.entry_unit)).setText(elem.get(ParseGeneric.API_UNIT)); } else { rl.findViewById(R.id.entry_unit).setVisibility(View.GONE); } if (elem.containsKey(ParseGeneric.API_NAME2)) { ((TextView) rl.findViewById(R.id.entry_name)).setText(elem.get(ParseGeneric.API_NAME2)); } else { rl.findViewById(R.id.entry_name).setVisibility(View.GONE); } if (elem.containsKey(ParseGeneric.API_LOCATION2)) { ((TextView) rl.findViewById(R.id.entry_location)) .setText(elem.get(ParseGeneric.API_LOCATION2)); } else { rl.findViewById(R.id.entry_location).setVisibility(View.GONE); } if (elem.containsKey(ParseGeneric.API_DESCRIPTION)) { ((TextView) rl.findViewById(R.id.entry_description)) .setText(elem.get(ParseGeneric.API_DESCRIPTION)); } else { rl.findViewById(R.id.entry_description).setVisibility(View.GONE); } if (elem.containsKey(ParseGeneric.API_PROPERTIES)) { ((TextView) rl.findViewById(R.id.entry_properties)) .setText(elem.get(ParseGeneric.API_PROPERTIES)); } else { rl.findViewById(R.id.entry_properties).setVisibility(View.GONE); } if (elem.containsKey(ParseGeneric.API_MACHINES)) { ((TextView) rl.findViewById(R.id.entry_other)) .setText(elem.get(ParseGeneric.API_MACHINES)); } else if (elem.containsKey(ParseGeneric.API_NAMES)) { ((TextView) rl.findViewById(R.id.entry_other)) .setText(elem.get(ParseGeneric.API_NAMES)); } else { rl.findViewById(R.id.entry_other).setVisibility(View.GONE); } vg.addView(rl); } } } // Stream and cam if (data.containsKey(ParseGeneric.API_STREAM) || data.containsKey(ParseGeneric.API_CAM)) { TextView title = (TextView) inflater.inflate(R.layout.title, null); title.setText(getString(R.string.api_stream)); vg.addView(title); inflater.inflate(R.layout.separator, vg); // Stream if (data.containsKey(ParseGeneric.API_STREAM)) { HashMap<String, String> stream = (HashMap<String, String>) data.get(ParseGeneric.API_STREAM); for (Entry<String, String> entry : stream.entrySet()) { final String type = entry.getKey(); final String url = entry.getValue(); TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setText(url); tv.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(Intent.ACTION_VIEW); i.setDataAndType(Uri.parse(url), type); startActivity(i); } }); vg.addView(tv); } } // Cam if (data.containsKey(ParseGeneric.API_CAM)) { HashMap<String, String> cam = (HashMap<String, String>) data.get(ParseGeneric.API_CAM); for (String value : cam.values()) { TextView tv = (TextView) inflater.inflate(R.layout.entry, null); tv.setText(value); vg.addView(tv); } } } } catch (Exception e) { e.printStackTrace(); showError(e.getClass().getCanonicalName(), e.getLocalizedMessage() + getString(R.string.error_generic)); } }