| Author |
Converting an XML document to HTML using Javascript and HTML
|
solomon alexander
Greenhorn
Joined: Mar 20, 2007
Posts: 19
|
|
Hi,
I need to convert an XML document to HTML using Javascript and HTML?
Could any of you point me in the right direction?
Thanks
Alex
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Well you could use XSLT and not use HTML and JavaScript.
How are you getting the XML Document, through Ajax?
Eric
|
 |
solomon alexander
Greenhorn
Joined: Mar 20, 2007
Posts: 19
|
|
My requirement is to keep the XML file locally in my machine.
Then to use javascript to load the XML and search for a text field and display the record in HTML
Could you point me in the right direction?
Solomon
|
 |
Saifuddin Merchant
Ranch Hand
Joined: Feb 08, 2009
Posts: 576
|
|
Eric is right you might XSLT to work out fine for you requirements.
Read up -> http://www.w3schools.com/xsl/xsl_client.asp
More information on XSLT --> http://www.w3schools.com/xsl/
HTH
|
Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
|
 |
solomon alexander
Greenhorn
Joined: Mar 20, 2007
Posts: 19
|
|
Hi,
I got your point.
But to be more precise on what I am looking for.
I will have an HTML form having 3 fields : Title , Artist and Country.
When I enter data into these fields , it should search against the XML and display into the screen.
I am doing some proof of concept on this, meanwhile if you guys have any hint, please provide.
Thanks
Solomon
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
JavaScript can not read local XML files do to security restrictions. The file has to live on the server for it to be read.
Eric
|
 |
solomon alexander
Greenhorn
Joined: Mar 20, 2007
Posts: 19
|
|
Hi,
Please find below the code to perform the task:
I m able to read an xml file using javascript, now in the process of refining the filter.
Please let me know,if i m doin anything wrong.
Solomon
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
document.all is a MAJOR NO NO. That is depreciated IE only code and will fail in any browser other than IE.
Also when you post code, please use code tags so it is readable.
Eric
|
 |
solomon alexander
Greenhorn
Joined: Mar 20, 2007
Posts: 19
|
|
Hi,
Please see the below XSLT code:
Could you let me know, how can i perform a search based on criteria. In other words, I want to filter data dynamically based on form data.
Any Hint would be highly appreciated.
Thanks
Solomon
|
 |
solomon alexander
Greenhorn
Joined: Mar 20, 2007
Posts: 19
|
|
Hi,
Could any of you point me in the right direction?
Thanks
Solomon
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56152
|
|
|
Please read this.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
solomon alexander
Greenhorn
Joined: Mar 20, 2007
Posts: 19
|
|
Hi,
Could anyone point me in the right direction?
Solomon
|
 |
 |
|
|
subject: Converting an XML document to HTML using Javascript and HTML
|
|
|