Rendering a HTML view in Flutter - html

I am receiving a response from the api which is HTML, and I would like to know how I render this answer, if there is a library or something.
I am very grateful, I am wanting to learn and I am having difficulties in some things.
The response from api is something like this:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/199
flutter: ║ 9/xhtml"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head id="j_idt3">
flutter: ║ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="C
flutter: ║ ontent-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" conte
flutter: ║ nt="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
flutter: ║ <meta name="apple-mobile-web-app-capable" content="yes" /><link type="text/css" rel="s
flutter: ║ tylesheet" href="/SiGCExterno-war/javax.faces.resource/theme.css.xhtml?ln=primefaces-parad
flutter: ║ ise-blue" /><link type="text/css" rel="stylesheet" href="/SiGCExterno-war/javax.faces.reso
flutter: ║ urce/fa/font-awesome.css.xhtml?ln=primefaces&v=7.0hc" />
It keeps going for a time
here is all the response: https://docs.google.com/document/d/1k_PsbFx5_x9SXPIBzDRpXa8TnJYlANMFVxhoTibZZZ4/edit?usp=sharing
How can i render this?

Try this package simple_html_css

Related

Use google maps javascript api on my cordova project

I want to use google maps javascript api on my cordova project. I noticed by a lot of search to need to implement white list policy in config.xml. But I can't understand what to implement in config.xml. Please help. Followings are my codes and trial result.
---config.xml---
<?xml version='1.0' encoding='utf-8'?>
<widget id="net.thinctank.onmap" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Map</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="https://maps.googleapis.com/maps/api/js?key=MYKEY" />
<allow-navigation href="https://maps.googleapis.com/maps/api/js?key=MYKEY" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
---index.html---
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>Hello World</title>
</head>
<body>
<div id="map"></div>
<script src="https://maps.googleapis.com/maps/api/js?key=MYKEY"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>
---index.js---
var app = {
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
onDeviceReady: function() {
this.receivedEvent('deviceready');
},
receivedEvent: function(id) {
console.log('Received Event: ' + id);
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
}
};
app.initialize();
I tried to execute by "cordova serve android" command but i got the error↓
"Refused to load the script 'https://maps.googleapis.com/maps/api/js?key=MYKEY' because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback."

Add meta tags to laravel page

I'm trying to add description and keywords to my Laravel pages.
Is this way working? Or there is something wrong?
#section('title')
{{trans('strings.About')}}
#stop
#section('description', 'Share text and photos with your friends and have fun')
#section('keywords', 'sharing, sharing text, text, sharing photo, photo,')
#section('robots', 'index, follow')
#section('revisit-after', 'content="3 days')
Are you extending another template that uses all these sections? They won't work on their own, they need to populate a placeholder in another template.
It should be something like:
<!-- layouts.master -->
<html>
<head>
<title>App Name - #yield('title')</title>
<meta name="description" content="#yield('description')">
<meta name="keywords" content="#yield('keywords')">
<!-- etc -->
</head>
<body>
...
</body>
</html>
And then your template should extend the other template.
#extends('layouts.master')
#section('title')
{{trans('strings.About')}}
#stop
#section('description', 'Share text and photos with your friends and have fun')
#section('keywords', 'sharing, sharing text, text, sharing photo, photo,')
#section('robots', 'index, follow')
#section('revisit-after', 'content="3 days')
At least, that is how I read their documentation: https://laravel.com/docs/5.2/blade
You can create only one section with all these important tags that I have mentioned below. And #yield this section in app layout <head> section of HTML code.
#section('meta_tags')
#if($obj)
<title>{{$obj->title}} - {{env('SITE_URL', 'Site Name')}}</title>
<meta name='description' itemprop='description' content='{{$obj->description}}' />
<?php $tags = implode(',', $obj->tags); ?>
<meta name='keywords' content='{{$tags}}' />
<meta property='article:published_time' content='{{$obj->created_at}}' />
<meta property='article:section' content='event' />
<meta property="og:description" content="{{$obj->description}}" />
<meta property="og:title" content="{{$obj->title}}" />
<meta property="og:url" content="{{url()->current()}}" />
<meta property="og:type" content="article" />
<meta property="og:locale" content="en-us" />
<meta property="og:locale:alternate" content="en-us" />
<meta property="og:site_name" content="{{env('SITE_URL', 'Site Name')}}" />
#foreach($obj->images as $image)
<meta property="og:image" content="{{$image->url}}" />
#endforeach
<meta property="og:image:url" content="{{obj->image}}" />
<meta property="og:image:size" content="300" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="{{$obj->title}}" />
<meta name="twitter:site" content="#BrnBhaskar" />
#endif
#endsection
I have better one!
Create Include file like this 'views/widgets/meta.blade.php'
<meta name="title" content="{{ $meta->meta_title }}"/>
<meta name="keywords" content="{{ $meta->meta_keywords }}"/>
<meta name="description" content="{{ $meta->meta_description }}"/>
<meta name="robots" content="index,follow"/>
<meta name="revisit-after" content="7 days">
<meta name="coverage" content="Worldwide">
<meta name="distribution" content="Global">
<meta name="title" content="{{ $meta->meta_title }}">
<meta name="author" content="{{ setting('site.title')}}">
<meta name="url" content="{{ request()->fullUrl() }}">
#isset($metaArray->og_image)
<meta name="og_image" content="{{ asset('storage/' . $meta->og_image) }}"/>
<meta name="og_secureImage" content="{{ asset('storage/' . $meta->og_image) }}"/>
<meta name="og_imageAlt" content="{{ $meta->og_imageAlt }}"/>
<meta name="og_imageType" content="{{ $meta->og_imageType }}"/>
#endisset
<meta name="rating" content="General">
<meta property=”og:title” content="{{ $meta->meta_title }}"/>
<meta property="og:description" content="{{ $meta->meta_description }}"/>
<meta property=”og:type” content=”{{ $meta->og_type }}”/>
<meta property="og:locale" content="en_us" />
<meta property="og:sitename" content="{{ setting('site.title') }}" />
<meta property="og:url" content="{{ request()->fullUrl() }}"/>
<meta name="twitter:card" content="summary"/>
<meta name="twitter:site" content="{{ setting('site.twitter_site') }}"/>
<meta name="twitter:creator" content="{{ setting('site.twitter_creator') }}"/>
And then whenever you want to include meta just pass array through the include
#include('widgets.meta',$meta)
And also you can replace setting() with $metaArray. I'm using Voyager.

Google Apps Script-How to get value from XmlDocument?

I am trying to get all calender details of all users. I got this successfully but its return result in Xml format as following:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>http://www.google.com/calendar/feeds/email-id/private/full</id>
<updated>2012-02-15T15:34:49.000Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/g/2005#event"/>
<title type="text">email-id</title>
<subtitle type="text">email-id</subtitle>
<link href="https://www.google.com/calendar/embed?src=email-id" rel="alternate" type="text/html"/>
<link href="https://www.google.com/calendar/feeds/email-id/private/full" rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"/>
<link href="https://www.google.com/calendar/feeds/email-id/private/full" rel="http://schemas.google.com/g/2005#post" type="application/atom+xml"/>
<link href="https://www.google.com/calendar/feeds/email-id/private/full/batch" rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml"/>
<link href="https://www.google.com/calendar/feeds/email-id/private/full?max-results=25" rel="self" type="application/atom+xml"/>
<author>
<name>Name</name>
<email>email-id</email>
</author>
<generator uri="http://www.google.com/calendar" version="1.0">Google Calendar</generator>
<openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:totalResults>
<openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:startIndex>
<openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">25</openSearch:itemsPerPage>
<gCal:timezone value="Europe/Dublin" xmlns:gCal="http://schemas.google.com/gCal/2005"/>
<gCal:timesCleaned value="0" xmlns:gCal="http://schemas.google.com/gCal/2005"/>
<entry>
<id>http://www.google.com/calendar/feeds/email-id/private/full/vj39u2qedgphrp10nah92h6ho0</id>
<published>2012-02-15T11:21:54.000Z</published>
<updated>2012-02-15T11:21:54.000Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/g/2005#event"/>
<title type="text">Test Appointment</title>
<content type="text">This is a test description</content>
<link href="https://www.google.com/calendar/event?eid=dmozOXUycWVkZ3BocnAxMG5haDkyaDZobzAgcmFoaW1AZGFtc2" rel="alternate" title="alternate" type="text/html"/>
...
</entry>
</feed>
I want to get the value of title and content.Please share me with the solution
Thank you
Use the built-in Xml service https://developers.google.com/apps-script/service_xml.
With this sevice you can parse thru the xml document.

Status Code Exception (com.google.gwt.user.client.rpc.StatusCodeException: 404 <html>)

I'm getting this error while running the login application (Using GWT-RPC). How can I resolve this? I have provided the error list as well. What I'm missing?
------VinLog.html
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="VinLog.css">
<title>VinLog</title>
<script language="javascript" src="com.login.vinayak.VinLog/com.login.vinayak.VinLog.nocache.js"></script>
</head>
<body>
<!-- OPTIONAL: include this if you want history support -->
<iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
</body>
</html>
------web.xml
> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC
> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet>
> <servlet-name>GreetingServiceImpl</servlet-name>
> <servlet-class>com.login.vinayak.server.GreetingServiceImpl</servlet-class>
> </servlet> <servlet-mapping>
> <servlet-name>GreetingServiceImpl</servlet-name>
> <url-pattern>/Login</url-pattern> </servlet-mapping> <!-- Default page to serve --> <welcome-file-list>
> <welcome-file>VinLog.html</welcome-file> </welcome-file-list>
> </web-app>
------error list
com.google.gwt.user.client.rpc.StatusCodeException: 404 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 NOT_FOUND</title>
</head>
<body><h2>HTTP ERROR: 404</h2><pre>NOT_FOUND</pre>
<p>RequestURI=/com.login.vinayak.VinLog/login</p><p><i><small>Powered by Jetty://</small></i></p><br/>
<br/>
<br/>
</body>
</html>
You registered your servlet for the URL "/Login", but you're calling "/login".
You need to change either the <url-pattern> to lower case, or your #RemoteServiceRelativePath to upper case. Then restart the server.

regex: how to replace a group of tags as a whole?

I want to replace all meta tags with a set of new meta tags. I have the following code
<?php
$header = '
<link rel="shortcut icon" href="/images/favicon.ico" />
<title>meta replace test</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="..." />
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="script.js"></script>';
$meta = '<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-language" content="en" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9" />';
$regex = '/<meta.*\/>/';
preg_match_all($regex, $header, $matches);
$header = preg_replace($regex, $meta, $header);
echo "<pre>";
echo print_r($matches);
echo "</pre>";
the meta tags in the $header should be replaced with the meta tags from $meta. There are 3 meta tags in the $header so it will replace 3 times unless I put all the meta tags next to eachother. I only want to replace once, no matter how many tags there are.
The regex I use is the following:
$regex = '/<meta.*\/>/';
If you want to replace all the <meta...> tags with the contents of $meta, you’ll have to remove the tags as a separate step, and then insert your replacement at a particular point.
This solution requires that the tags are in a well-formed format. Note that it hasn’t been tested.
$header = preg_replace(/<meta\s.*?\/>/isg, "", $header);
$header = preg_replace(/(<\/title>[\s\n]*)/is, "$1$meta", $header);