Is this XHTML document valid for parsing with the iPhone - iphone

I would be grateful if someone could clarify if this document is valid for xhtml parsing using the iphone SDK using xpaths:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>East Lancs Radio - Now Playing</title>
<META HTTP-EQUIV="REFRESH" CONTENT="45">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<div id="player-currently-playing">
Currently Playing
<div class="player-track">
Lush
</div>
<div class="player-artist">
Ladykillers
</div>
</div>
<div id="player-playing-next">
Playing Next
<div class="player-track">
Javine
</div>
<div class="player-artist">
Surrender (Your...
</div>
</div>
</body>
</html>
I'm trying to extract the currently playing player-track 'lush' and player-artist 'ladykillers' through using xpath. If I do an xpath search for: //#class and then print the result to screen, I get player-track, player-artist.. etc outputted?
Am I missing something fairly obvious here?
Thanks
Dan

The W3C Markup Validation Service comes up with 9 errors in this document.
So, this is not a valid XHTML document, for iPhone usage or otherwise.

Your XPath result is giving you what you're asking for which is the values of the class attributes.
To get the currently playing player-track use:
//*[#id = 'player-currently-playing']/*[#class = 'player-track']/text()
and to get the currently playing player-artist use:
//*[#id = 'player-currently-playing']/*[#class = 'player-artist']/text()

Related

Can the included (pasted into the body) htm code hurt me?

I received an email yesterday supposedly from the IRS. Since I was expecting to hear from the IRS, I paid attention to it and found it had an htm attachment. I didn't open it, but I'm curious how this code could hurt me if I had opened it.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Redirecting ....</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<script>
window.location.replace("https://lomkpcyzgo63bf0b69184dd.example.ru/Mrick#example.com");
</script>
</div>
</body>
</html>

Change order of Title tag in moodle login page

Currently Moodle add Content-Type meta Tag
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
after Title tag
<title>Mount Orange School: Log in to the site</title>
within Head tag.
<head>
<title>Mount Orange School: Log in to the site</title>
<link rel="shortcut icon" href="https://school.demo.moodle.net/theme/image.php/boost/theme/1511289361/favicon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
...
...
</head>
How can we change this order with minimum change in moodle3.1 core(https://github.com/moodle/moodle/blob/MOODLE_31_STABLE/login/index.php#L374). Putting Content Type meta tag on top within Head tag. Something like this.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mount Orange School: Log in to the site</title>
<link rel="shortcut icon" href="https://school.demo.moodle.net/theme/image.php/boost/theme/1511289361/favicon" />
...
...
</head>
We are using http://nutch.apache.org/ and it is not reading title if Content type Meta is not defined as first tag in Head.
Ref1: view-source:https://school.demo.moodle.net/login/index.php
Ref2: https://school.demo.moodle.net/login/index.php
Ref3: https://github.com/moodle/moodle/blob/MOODLE_31_STABLE/login/index.php#L374
There are two ways of doing it.
Change the core code here https://github.com/moodle/moodle/blob/MOODLE_31_STABLE/theme/bootstrapbase/layout/columns1.php#L30
Create Custom theme and import base theme and make changes there.
https://edwiser.org/blog/create-child-theme-moodle/
https://docs.moodle.org/dev/Themes
Change which require is
<head>
<title><?php echo $OUTPUT->page_title(); ?></title>
<link rel="shortcut icon" href="<?php echo $OUTPUT->favicon(); ?>" />
<?php echo $OUTPUT->standard_head_html() ?>
.....
to
<head>
<?php echo $OUTPUT->standard_head_html() ?>
<title><?php echo $OUTPUT->page_title(); ?></title>
<link rel="shortcut icon" href="<?php echo $OUTPUT->favicon(); ?>" />
....

How to, with outlook client, perform reply with a HTML button?

I'm developing one WPF application with email integration.
The emails generated by application are simply HTML pages like that:
<!DOCTYPE html>
<html>
<head>
<title>My Title</title>
<meta charset="utf-8" />
<style type="text/css">
</style>
</head>
<body>
<div>
<div class="actions">
Approve
Reject
</div>
</div>
</body>
</html>
I need to know how to create one HTML button that can perform automatically reply with outlook.
Can you help me?
Thanks
HTML in Outlook is rendered by Word, not IE. Your HTML scripts and buttons will not run inside Outlook.
<!DOCTYPE html>
<html>
<head>
<title>My Title</title>
<meta charset="utf-8" />
<style type="text/css">
</style>
</head>
<body>
<div>
<div class="actions">
<button onclick="location.href='mailto:myemail#mail.com?subject=Approve'">Approve</button>
<button onclick="location.href='mailto:myemail#mail.com?subject=Reject'">Reject</button>
</div>
</div>
</body>
</html>

Phonegap build 3.7, HTML, window.open redirect on iphone

I am trying to do a simple redirect in a Phonegap built (version 3.7) from the opening index.html to another html (main2b.html) on an iphone with no success. It works fine on Android. This is a simplified test of what I need to do.
If I window.location.href='http://www.google.com' as an example it DOES NOT work. (and yes I have white listed it in my config.xml)
If I window.location.href='main2b.html' it just spins and does NOT work either.
For testing purposes the main2b.html is just a simple 'hello' in a div.
I have tried various pathing options of main2b.html with no success so I feel it is not a pathing issue. Both html files are in the same location.
Here is the code sample. Would appreciate any thoughts. This seems like such a simple thing and cannot figure out what is wrong.
Once this simple test works, I need to do something like this where I will detect if my app is 'offline' and as such go to a different html file. This is why I am doing this before any jquery/mobile init stuff which would come later if I detect I am 'online'.
The index.html code:
<!DOCTYPE html>
<html>
<head>
<title>The Conspiracy Show</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1 user-scalable=no, " />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- Phonegap build stuff required ----------- -->
<script src="cordova.js"></script>
<!------------------------>
<script>
function onLoad(){
alert('here at onLoad');
document.addEventListener("deviceReady", deviceReady, false);
}
function deviceReady() {
alert('here at deviceReady')
window.location.href = "main2b.html";
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>
main2b.html looks like this
<!DOCTYPE html>
<html>
<head>
<title>The Conspiracy Show App</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"/>
<meta name="keywords" content="conspiracy Richard Syrett talk show Coasttocoastam paranormal callIn"/>
<!-- Required Stuff for PhoneGap prevent page flickering in iOS----------- -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- Phonegap build stuff required ----------- -->
<script src="cordova.js"></script>
</head>
<body style="background:#2D5873;" >
<div align="center" style="margin:0px; padding:0px;">
Hello
</div>
</body>
</html>
I found my own problem. Apparently, in iPhone, if you dont specifically close the splash screen (which can only be done after deviceReady), any redirection will not work. On android, the splash screen close can be done immediately. Anyway, problem solved.

Minimum includes for Alfresco Share custom page?

I am creating a custom Share page that must have none of the Alfresco UI on it, but which still needs access to the Alfresco and YAHOO objects.
I have successfully created the page and caused it to open in a new tab, but I get errors that the Alfresco and YAHOO objects are undefined.
What are the minimum includes I must add to my Freemarker template to get access to those objects?
Update: I have gotten the Alfresco and YAHOO objects to load, but now am getting "Uncaught Error: extend failed, please check that all dependencies are included."
Here are the freemarker and javascript includes I've got so far, if it'll help:
<#import "import/alfresco-common.ftl" as common />
...
<script type="text/javascript" src="../scripts/ajax/yahoo/yahoo-min.js"> </script>
<script type="text/javascript" src="../scripts/ajax/yahoo/connection/connection-min.js"> </script>
<script type="text/javascript" src="../scripts/ajax/common.js"> </script>
<script type="text/javascript" src="../scripts/ajax/utilities/utilities.js"> </script>
<script type="text/javascript" src="../yui/yuiloader/yuiloader.js"> </script>
<script type="text/javascript" src="../js/alfresco.js"> </script>
Update 2: Based on the first answer, the first few lines of the template look like this and again yield Uncaught ReferenceError: YAHOO is not defined:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<region-id>head-resources</region-id>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<title></title>
<script>
var urlParams;
Update 3: I've reduced the source to the minimum necessary to demonstrate the problem. What follows next is the template component definition file, followed by the freemarker template itself. Definition:
<?xml version='1.0' encoding='UTF-8'?>
<page>
<title>iPad Viewer</title>
<title-id>page.iPad.title</title-id>
<description>iPad Viewer</description>
<description-id>page.iPad.description</description-id>
<template-instance>viewer-ipad</template-instance>
<authentication>user</authentication>
</page>
Freemarker template:
<html>
<body>
<div class="content">
<#region-id>head-resources</#region-id>
<script>
alert(YAHOO);
alert(Alfresco);
</script>
</div>
</body>
</html>
Error is:
Caused by: freemarker.core.ParseException: Parsing error in template "org/alfresco/viewer-ipad.ftl" in line 11, column 7: Unclosed #... when the end of the file was reached.
I'm not sure how you created the page, but this is not needed when you define your regions.
Probably there are all in the <region-id>head-resources</region-id> So if you include that in the page-template that should suffice.