This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Converting an XML document to HTML using Javascript and HTML

 
solomon alexander
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you could use XSLT and not use HTML and JavaScript.

How are you getting the XML Document, through Ajax?

Eric
 
solomon alexander
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 607
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
solomon alexander
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Could any of you point me in the right direction?

Thanks
Solomon
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this.
 
solomon alexander
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Could anyone point me in the right direction?

Solomon
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic