944,081 Members | Top Members by Rank

May 8th, 2006
0

Displayind data in XML file using HTML

Expand Post »
Hi everybody,

I have a XML file having data stored in tags as

<Username>User name here</Username>
<Password>Password here</Username>

(There will be data of around 100 users)

I need to display this data in a HTML file in a tabular format.
Kindly help me.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Gody is offline Offline
8 posts
since Jun 2005
Jun 6th, 2006
0

Re: Displayind data in XML file using HTML

Try creating an XSLT (XML style) file and most browsers will properly render the XM. There are lots of tutorials on the web on this. Hope that helps.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
g8trGTO is offline Offline
3 posts
since Jun 2006
Jun 9th, 2006
0

Re: Displayind data in XML file using HTML

If you know javascript you could use Ajax. This will give you the ability of updating just those fields with out having to call the whole page if you wish.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
bwhiti is offline Offline
6 posts
since May 2006
Jun 13th, 2006
0

Re: Displayind data in XML file using HTML

Hi Gody,

You can use XSLT to format the pages like the way you want

Refer to http://www.w3schools.com/xsl/default.asp and find the formatting.

Remember to include the reference to your XSLT file you created in the xml

The sample xslt file will be like this...........


<?xmlversion="1.0"encoding="iso-8859-1"?>
<
xsl:stylesheetversion="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<
xsl:templatematch="/">
<
html>
<
body>
<
h2>My page</h2>
<
tableborder="1">
<
trbgcolor="#9acd32">
<
th>Date</th>
<
th>Purpose</th>
</
tr>
<
xsl:for-eachselect="SalesVisit/Details">

<
tr>
<
td>
<
xsl:value-ofselect="Date"/>
</
td>
<
td>
<
xsl:value-ofselect="Purpose"/>
</
td>
</
tr>
</
xsl:for-each>
</
table>
</
body>
</
html>
</
xsl:template>
</
xsl:stylesheet>



MY Raw xml file before formatting was like this...

<?xmlversion="1.0"encoding="UTF-8"?>
<?
xml-stylesheettype="text/xsl" href="XSLTFile.xsl"?>
<
SalesVisit>
<
Details>
<
Date>1/1/2006</Date>
<
Purpose>Sales Visist 1</Purpose>
</
Details>
<
Details>
<
Date>2/1/2006</Date>
<
Purpose>Sales Visist 2</Purpose>
</
Details>
<
Details>
<
Date>3/1/2006</Date>
<
Purpose>Sales Visist 3</Purpose>
</
Details>
<
Details>
<
Date>4/1/2006</Date>
<
Purpose>Sales Visist 4</Purpose>
</
Details>
</
SalesVisit>


by Rajesh C Medackel, TVM, India
Last edited by inkrajesh; Jun 13th, 2006 at 3:54 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
inkrajesh is offline Offline
2 posts
since Jun 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in RSS, Web Services and SOAP Forum Timeline: How to Parse XML file
Next Thread in RSS, Web Services and SOAP Forum Timeline: how xml is useful?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC