I would like to do a basic search functionality but the data I am using is XML - How would I got about making a search form that can filter the data from the XML and display it in HTML whether it meets the HTML form's criteria.
I have not yet tried to use a HTML form to display the XML data as I do not know how to do this, therefore I am asking for direction or examples that may be elsewhere in the web, as I ma having trouble doing so.
<UKPRN>10004048</UKPRN>
<ACCOMURL>http://www.londonmet.ac.uk/accommodation/</ACCOMURL>
<PRIVATELOWER>5000</PRIVATELOWER>
<PRIVATEUPPER>8300</PRIVATEUPPER>
<COUNTRY>XF</COUNTRY>
<NSP>1</NSP>
<Q24>51</Q24>
<Q24POP>2242</Q24POP>
<KISCOURSE>
<TITLE>FdSc Crime Scene and Forensic Investigation</TITLE>
<UCASCOURSEID>F411</UCASCOURSEID>
<VARFEE>10</VARFEE>
<FEETBC>1</FEETBC>
<WAIVER>0</WAIVER>
<MEANSSUP>0</MEANSSUP>
<OTHSUP>0</OTHSUP>
<ENGFEE>5700</ENGFEE>
</KISCOURSE>
There is just a basic look at my XML set up - any help is appreciated!
EDIT: Further to the question asked below, The XML data is structured as above, and I wish for some PHP or Html Form to search the Title of the title KISCOURSE and then display relevant searches.
Since this is rather a bigger project than a short question my answer just aims to give you some ideas on how I would approach this. Tell me whether you think it is helpful and if you have further questions.
Assuming that you have your data in one XML file, e.g. data.xml, and you have access to PHP and its XSLTProcessor class I would do the following:
Create an HTML form with inputs for the fields you want to query
Write an XSL transformation to filter data.xml on the wanted parameters
Write a PHP script that gets parameters from the HTML form, applies them to the transformation, executes it and outputs the result
Tell me if you find this approach suitable for you and I can add more detail. Good luck!
Related
How am I able to get specific data from a website? If it helps then the data I need is labeled under a unique html class.
Get a web page.
Make it a DOM structure.
Traverse it with xPath: //*[#class='target_class']
Output results.
If you share a language that you use, I may give you some posts with examples. For php read here.
You can use Beautifulsoup to do what you want in python.You can scrape data from a specific html class.See here http://www.crummy.com/software/BeautifulSoup/bs4/doc/
I'd like to achieve the following and I'm looking for ideas. I have a document and I want to represent/transform this content in/to a nice SAPUI5 framework. My idea is the following: a split app with having the paragraph titles in the master view (plus a search function on top) and the respective content in the detail view.
I'd like to know from you if
a) you might want to share your ideas and hints on alternatives.
b) this can be achieved within one single file (i.e. all the code for the split app and document content in one html) and maybe using pure html code (xml also feasible) - against the background of easily handing a large amount of text available in html.
c) if you happen to have/know a reusable template.
Thanks in advance!
An interesting question. I went through a similar exercise once, re-presenting my site with UI5.
To your questions:
(a) I would think that the approach you suggest is a good one
(b) You can indeed include all the app in a single file, I do that often by using script templates, even with XML Views. You can see some examples in my sapui5bin repository, in particular in the SinglePageExamples folder. Have a look at this html file for example: https://github.com/qmacro/sapui5bin/blob/master/SinglePageExamples/SAP-Inside-Track-Sheffield-2014/end.html
What I would suggest is, rather than intermingle the document content and the app & view definitions, maintain the content of your document separately, for example, in XML or JSON, and use a client side model to load it in and bind the parts to the right places.
I just want to automate a web application, where that application parses the HTML page and pulls all the HTML Tags inner text based on some condition like if we have a tag called Span Example has given whose class="spanclass_1"
This is span tag...
which has particular class id. so that app parses and pulls that span into it.
And here the main pain area is, I should not use the developer code to automate that same parsing the HTML.
I want to automate that parsing done correctly, simply by using the parsed data which is shown in UI.
Any help, would be great.
Appreciating your time reading this.
(Note span tag is not shown)
Thanks buddies.
not enough details.
is this html page just a file in local filesystem on it is internet webpage?
do u have access to pages? can u modify it ? if answer yes, that just add javascript to page which will extract data and post to server.
if answer not, than it depends on language u use to programm.
Find good framework to parse html. load page parse it and extract data. Several situation can be there.
Worse scenario - page generated on client side using js.
Best scenario - page is in xhtml mode( u are lucky. any xml parser will help to build dom and extract data)
So so - page is simple html format (try several html parser to find most suitable for u)
I was looking at the web queries in excel and how you can retrieve data from a html table in a website quite easily. I wish to get a single string from within a html tag:
<span class="linePrice">I WANT THIS DATA<!----></span>
Is this possible? If it is, how? A vbn solution would also be useful.
Thanks!
you can get that information from the DHTML DOM Document
see these links:
MSDN Library - DOM Document Reference
MSDN Library - getElementById Method
Is there any microformat/standard for implementing search form on the site?
(access keys, naming etc.)
Any good practices?
The only things I can think of are that searches should be GET requests, and that you may want to implement a RESTful API that allows developers to query JSON and XML results in addition to HTML
If you are trying to implement a plugin for browsers like IE and Firefox to allow for search/autocomplete in the search box of the browser, check out this: https://developer.mozilla.org/en/creating_opensearch_plugins_for_firefox
Here are some conventions I follow. Forgive me if these are not exactly on topic with microformats, or "technically not" in the way I describe the various parts to my answer.
I have found validation in these few standards I've copied from others:
HTML form ID = "search"
Action URL for the form is //root-of-site/search/
Search Results URL construct:
//root-of-site/search?q=queryClause1+Clause2&AnotherParamName=foo
[personally that structure bugs me a little because search-forward-slash appears to be a directory, and the search-question-mark looks like a page taking a query string, and IMO a page should have a suffix. I've been tempted to use search.cgi or search.app, but I see the big guys using /search?q= and so it is]
ID of search query is "q" (this is nearly universal in adoption)