|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
displaying xml in html
here's the xml file that i'm working with:
Code:
<URI_protein pdb_id="1MCP"> <attributes pdb_id="1MCP"> <header classification="IMMUNOGLOBULIN" deposition_date="09-JUL-84" pdb_id="1MCP"/> <compounds pdb_id="1MCP"> <compound compound_id="1">IMMUNOGLOBULIN FAB FRAGMENT (MC/PC$603)</compound> </compounds> <sources pdb_id="1MCP"> <source source_id="1">MOUSE (MUS $MUSCULUS)</source> </sources> </attributes> <annotation pdb_id="1MCP"> <annotation_authors pdb_id="1MCP"> <author author_id="1" author_name="Y.SATOW"/> <author author_id="2" author_name="G.H.COHEN"/> <author author_id="3" author_name="E.A.PADLAN"/> <author author_id="4" author_name="D.R.DAVIES"/> </annotation_authors> </annotation> </URI_protein> I want to display all this in an html page. Here's the code I have for the html: Code:
<HTML>
<HEAD>
<TITLE>Test XML</TITLE>
</HEAD>
<BODY>
<XML ID="dsoData" SRC="testxml.xml"></XML>
<H2>TEST XML</H2>
<SPAN DATASRC="#dsoData" DATAFLD="URI_protein">
<SPAN DATAFLD="$TEXT"></SPAN>
<SPAN DATAFLD="pdb_id"></SPAN>
</SPAN>
<SPAN DATAFLD="compound">
<SPAN DATAFLD="$TEXT"></SPAN>
</SPAN>
</BODY>
</HTML>
well this doesn't work, and nothing from the xml file is displayed. Please someone help me on this. |
|
#2
|
||||
|
||||
|
XML isn't accessed directly from HTML... you need to use XSL to transform the data in your XML file into HTML...
__________________
Give a person code, and they'll hack for a day; Teach them how to code, and they'll hack forever. Analyze twice; hack once. The world's first existential ITIL question: If a change is released into production without a ticket to track it, was it actually released? About DrGroove: ITIL-Certified IT Process Engineer - Enterprise Application Architect - Freelance IT Journalist - Devshed Moderator - Funk Bassist Extraordinaire |
|
#3
|
||||
|
||||
|
I thought the same thing ... but when I read this post it looks like you can do what mcrrll is talking about in IE.
Here is the post: http://forums.devshed.com/t125681/s.html I am also unable to get it to work. I even tried the example that W3Schools provides that is mentioned in the post I linked. |
|
#4
|
||||
|
||||
|
Quote:
Well, the last thing I'm going to do on a forum dedicated to open source technologies is promote or encourage a user to rely on a Microsoft-specific methodology for parsing XML into HTML. ![]() |
|
#5
|
|||
|
|||
|
I created an xml doc to display the xml. Here it is:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Protein DATA</h2>
<xsl:for-each select="URI_protein">
URI Protein pdb id =
<xsl:value-of select="@pdb_id"/><BR/>
Attributes of pdb id
<xsl:value-of select="attributes/@pdb_id"/><BR/>
Classification:
<xsl:value-of select="attributes/header/@classification"/><BR/>
Deposition Date:
<xsl:value-of select="attributes/header/@deposition_date"/><BR/>
Pdb id:
<xsl:value-of select="attributes/header/@pdb_id"/><BR/>
Compounds of pdb id:
<xsl:value-of select="attributes/compounds/@pdb_id"/><BR/>
Compound id:
<xsl:value-of select="attributes/compounds/compound/@compound_id"/><BR/>
Compound:
<xsl:value-of select="attributes/compounds/compound"/><BR/>
Sources of pdb id:
<xsl:value-of select="attributes/sources/@pdb_id"/><BR/>
Source id:
<xsl:value-of select="attributes/sources/source/@source_id"/><BR/>
Source:
<xsl:value-of select="attributes/sources/source"/><BR/>
Annotation for pdb id:
<xsl:value-of select="annotation/@pdb_id"/><BR/>
Annotation authors for pdb id:
<xsl:value-of select="annotation/annotation_authors/@pdb_id"/><BR/>
Authors:<BR/>
<xsl:for-each select="annotation/annotation_authors/author">
<tr>
<td><xsl:value-of select="@author_id"/></td>
<td><xsl:value-of select="@author_name"/></td>
<BR/>
</tr>
</xsl:for-each>
</xsl:for-each>
</body>
</html>
</xsl:template></xsl:stylesheet>
Now how do I display the xml? Do I have a link in html to the xml file and then will display it? Can I make any calls from html to get specific information from the xsl or xml? |
|
#6
|
||||
|
||||
|
Quote:
Actually, this is not entirely true. If he were to use "Data Islands", which at the moment are only fully supported by IE, he could definately do this. See this link: http://www.w3schools.com/xml/xml_data_island.asp One thing to remember is that if you use data islands, only IE will display the information correctly. ( at least that is what I have seen ). Regards, jlk |
|
#7
|
||||
|
||||
|
Quote:
Again, thats a technique not supported by the W3C, and is currently a Microsoft-specific technique... re-read this post for my take on the issue: http://forums.devshed.com/showpost....076&postcount=4 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > displaying xml in html |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|