how to retrieve the data from xml and display it in table in html - html

I wanted to develop a small search website where I will be storing the data in XML files. When we search anything, it should display those data as table format in html. How does one retrieve the data from XML files?
Below is the basic thing to display data of only two columns, but I want to display data dynamically:
html file:http://www.w3schools.com/xml/xml_applications.asp
This is the sample code for retrieving the data from xml only for two columns.

Well the first problem I see is that you have two functions in there that are not being called. Nothing programmatic will happen in this scenario. When you have a method you need to call said method with myFunction(). I would recommend reading up a little more on javascript instead of copying and pasting it and expecting it to just "work"
To further elaborate, you removed the function call from the example you took when you took off the button. What is your xml endpoint? (it's not going to be the same as the example unless you build it to be that way). In this example it's just an xml file that is hosted on the server with the same root as the html.

Related

Saving HTML Table Object(s)

Blocked out the data for personal reasons.
Essentially I am passing images from a MongoDB to NodeRed and parsing the actual image file back to base64 to create a set of up to 100 images (records) and the "alarm" description. The table is done in HTML template with input coming from Mongo Query.
With 3 pieces of information that is "linked" together (Time, Alarm, Image) the information separately does no good.
What I'm trying to determine if there is a good way to download the full table (images included) in a logical way.
Methods tried:
Excel download - Formatted properly, rows/columns exist but images are not saved properly because they technically aren't being stored in the table, just referencing from the MongoDB Query.
Canvas->Table inside Canvas: this one has yielded little success. Idea: Make a canvas and have the table inside (yielding an image that could be saved, removing search-ability but easy to view). Either I don't fully understand how HTML canvas drawing works or Node-Red handles some things differently. I got a blank canvas when linking table to canvas by object ID of table.
SelectAll/Copy/Paste: This one works, pasting into a doc has everything formatted in table, but not automated/scripted.
Looking for a way to "triggered"/on button press to save the current table contents and save them. CtrlP/print to PDF and such work fine. Looking specifically to save the Table or an object similar in nature.
I cannot post/link the flow because of data/security reasons.
If there is a better option for managing data that needs to be in a format with 3 columns and 100 rows I am also open to changing the HTML. I am not an expect in best practices for frontend, this is only going to be used for creating a report.

use WWW::Mechanize without FETCHING url data (raw)

I am spending too much time writing code that already happens easily with WWW::Mechanize.
I'm searching for specific <td> classes in HTML using WWW::Mechanize. When I find my specific entry and append it to a list, I want to also initiate another WWW::Mechanize object on raw HTML data (as in, "fetch" the page; the page being my raw HTML data).
I can't find any constructors for WWW::Mechanize to construct without ->get() / etc. I just want to feed my raw HTML data into a new object and go from there, but I just can't find how!
I think I clarified my question without the need of posting code, but will if requested.

XML/JSON query to create Database

My coding knowledge is very basic so please do bear that in mind. Basically there is a encoding service called vid.ly. We have hundreds of videos on there and would like to create an excel spreadsheet with all the information of them.
Vidly accepts API queries in XML and JSON. Below is a basic example of the query I want to make:
http://api.vid.ly/#GetMediaList
Is there a way that I can get Excel to send that query to the Vidly website, receive an XML/JSON response and make a table from it? I have gotten it to work with an XML generated manually but I really want Excel to pull that information automatically.
Sure, you need to write VBA code in excel sheet. Refer to following urls
https://msdn.microsoft.com/en-us/library/dd819156%28v=office.12%29.aspx
http://www.dotnetspider.com/resources/19-STEP-BY-STEP-Consuming-Web-Services-through-VBA-Excel-or-Word-Part-I.aspx
http://www.automateexcel.com/2004/11/14/excel_vba_consume_web_services/

Using a JSON file instead of a database - feasible?

Imagine I've created a new javascript framework, and want to showcase some examples that utilise it, and let other people add examples if they want. Crucially I want this to all be on github.
I imagine I would need to provide a template HTML document which includes the framework, and sorts out all the header and footer correctly. People would then add examples into the examples folder.
However, doing it this way, I would just end up with a long list of HTML files. What would I need to do if I wanted to add some sort of metadata about each example, like tags/author/date etc, which I could then provide search functionality on? If it was just me working on this, I think I would probably set up a database. But because it's a collaboration, this is a bit tricky.
Would it work if each HTML file had a corresponding entry in a JSON file listing all the examples where I could put this metadata? Would I be able to create some basic search functionality using this? Would it be a case of: Step 1 : create new example file, step 2: add reference to file and file metadata to JSON file?
A good example of something similar to what I want is wbond's package manager http://wbond.net/sublime_packages/community
(There is not going to be a lot of create/update/destroy going on - mainly just reading.
Check out this Javascript database: http://www.taffydb.com/
There are other Javascript databases that let you load JSON data and then do database operations. Taffy lets you search for documents.
It sounds like a good idea to me though - making HTML files and an associated JSON document that has meta data about it.

Store Data in an HTML file

Wanted to know if the following scenario is possible -
I have some data that is in an excel file. I want to make an html page which will have this data inside it (no other source of data). And inside the Html page, will I be able to put textfields, buttons etc for a user to input data and based on that, i need to write queries (jqueries i guess) to show the data that is the result of those queries
Can this be done? I have not done anything so far. I just wanted to know if this is possible and please someone point me in the right direction for me to start. I wanna learn on my own how to do this.
Thanks in advance.
HTML is a markup language - it is the structure of a webpage, and has no mechanisms for storing or processing dynamic data.
You will have to use a client-side language JavaScript + cookies, or a server-side language like PHP + MySQL.
You want to look at using JavaScript in the page. On the server (I presume) you need to read the Excel file, and generate JS objects on the page that hold the values. That is, the JS when run creates a collection of JS objects with the values in it. This script can be embedded in the page so that no other data access is needed.
You can then write more JS linked to the buttons that select data out of these objects, and displays them on the page. You probably don't want to do this from scratch -- there are good JS libraries and frameworks to leverage. Consider either GWM or YUI.
Perhaps the simplest way is to open the file in Excel and save it as text (tab-separated; comma-separated would do, too), then insert this text data into your HTML document between the tags <script type="text/plain"> and </script>. You can then write, in a rather straighforward way, JavaScript code that reads the content of this element and constructs a JavaScript array of objects (or some other suitable data structire) from it. It will then be easy to access the data in JavaScript.
This will make it possible to run queries and display data. Modifying the data would be a completely different matter.