Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
 
     
   Compare ISP   Rate your ISP
   Glossary   Glossary
 
Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: 1 [2]

Author Topic: Serving (slightly) better stats directly from Zyxel modems  (Read 1108 times)

Weaver

  • Addicted Kitizen
  • *****
  • Posts: 6104
  • Retd sw dev; A&A; 4 × 7km ADSL2; IPv6; Firebrick
Re: Serving (slightly) better stats directly from Zyxel modems
« Reply #15 on: July 03, 2018, 11:39:48 PM »

Request: could we make all web output XHTML instead of html, so that I can process the results with an XML parser? Would make it miles easier for the likes of to write tools that filter or query the output because I could pipe the output into an XSLT program.

(There is of course an XHTML dialect corresponding to HTML5, which is up-to-date, as well as the old favourite XHTML 1.0.) There might be some subtle interactions with javascript code in web pages because of the difference between xml and html in this respect.

If you think it is too much pain then I can appreciate that. It would mean running pages through a validator and checking that they are well-formed XML as well as XHTML5 or XHTML1.0.

A possibly bad idea: Some people generate an alternative XML page at a different URL, the Firebrick router does this, I think. Seems a bit wasteful to me because if it is done very cleanly and properly then the page can be easy enough to process, especially if extra id and class values are supplied as ‘hooks’ to help locate elements, and all unnecessary presentational crud is left out and implemented by CSS. The two-files idea is to give the user one that is pretty to look at for eyeballs and another that is lean and mean and easy to parse for machines. But with really good design it should be possible to do both in one to a great extent.
« Last Edit: July 04, 2018, 02:52:33 AM by Weaver »
Logged

johnson

  • Reg Member
  • ***
  • Posts: 495
Re: Serving (slightly) better stats directly from Zyxel modems
« Reply #16 on: July 04, 2018, 01:34:58 AM »

You're giving me flash backs to a first year web dev course where the exam had a final question along the lines of "now rewrite everything you have done using XHTML and XSL"... nobody was a fan, then I never encountered it again! The lecturer was a fairly old school type, was adamant we all had to sign up to some weird british computing society, made a point of showing him bring up his network interfaces on the CLI after plugging in the projector... I digress.  :D

What benefit does using XML to define webpages really have? Doesn't seem to be in wide use.

All I have at the moment in terms of HTML is a few named canvas elements, all the rest is my nasty excuse for javascript for parsing the output of xdslctl and structuring the data so it works with Chart.js.

Edit: If you mean producing an XML version of the data from the xdslctl output then thats doable I guess.
« Last Edit: July 04, 2018, 01:37:50 AM by johnson »
Logged

Weaver

  • Addicted Kitizen
  • *****
  • Posts: 6104
  • Retd sw dev; A&A; 4 × 7km ADSL2; IPv6; Firebrick
Re: Serving (slightly) better stats directly from Zyxel modems
« Reply #17 on: July 04, 2018, 02:48:08 AM »

XHTML is just XML that uses html elements out of a particular namespace.

All that it means for the author is just writing the source according to the very simple xhtml rules,
* always use utf8,
* lowercase element names,
* always close empty elements with <element /> type syntax eg <hr /> <br />,
* otherwise always having a matching closing tag for every start tag eg <p>blah</p> and never omitting the closing tag </p>,
* it needs <html xmlns="http://www.w3.org/1999/xhtml">
* and it needs to be validated with the w3c's checker really (web-based) and an xml validator (many good web-based ones can be googled) as any authoring mistakes defeat the point of making it machine-readable and xml-parser-friendly.

It is that easy. There are some considerations with javascript that I have not covered here. If you are ok with using the stricter markup syntax then that would be excellent, otherwise don’t worry about it.

Some useful stuff at:
https://www.w3.org/TR/html-polyglot/#writing
https://www.w3.org/TR/xhtml1/guidelines.html

The main advantage is for users. XHTML is far more machine-readable because its syntax is very rigid with no peculiar quirks as in tag soup markup or html5. Users can use XML-speaking tools to process the page, so if a user wants to extract information from it it is so much easier because these tools can find content, strip it down or filter it very conveniently. This is doable because a large range of high quality XML parsing tools are available and the XSLT programming language can be used to read, filter and generate xml and xhtml because xhtml is an application of xml.

Html5 as well as html4 can be written according to the above few simply xhtml syntax authoring rules and then the source is XHTML5 too and so also is automatically XML without anything further being needed.

One benefit to the author is that authoring mistakes can be spotted quickly
« Last Edit: July 04, 2018, 03:07:25 AM by Weaver »
Logged
Pages: 1 [2]