XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 12th, 2004, 02:34 PM
mcrrll mcrrll is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 13 mcrrll User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old March 12th, 2004, 04:40 PM
drgroove's Avatar
drgroove drgroove is offline
pushing envelopes, not pencils
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Feb 2002
Posts: 6,225 drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Day 4 h 44 m 44 sec
Reputation Power: 174
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


Reply With Quote
  #3  
Old March 13th, 2004, 01:36 PM
MattSidesinger's Avatar
MattSidesinger MattSidesinger is offline
Java PHP Oracle Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: C-Bus OH-IO
Posts: 204 MattSidesinger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 26 sec
Reputation Power: 5
Send a message via AIM to MattSidesinger
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.

Reply With Quote
  #4  
Old March 13th, 2004, 03:12 PM
drgroove's Avatar
drgroove drgroove is offline
pushing envelopes, not pencils
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Feb 2002
Posts: 6,225 drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Day 4 h 44 m 44 sec
Reputation Power: 174
Quote:
Originally Posted by MattSidesinger
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.


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.

Reply With Quote
  #5  
Old March 16th, 2004, 10:16 AM
mcrrll mcrrll is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 13 mcrrll User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #6  
Old March 16th, 2004, 02:27 PM
jlk's Avatar
jlk jlk is offline
Perl Jedi
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: New Hampshire
Posts: 108 jlk User rank is Sergeant (500 - 2000 Reputation Level)jlk User rank is Sergeant (500 - 2000 Reputation Level)jlk User rank is Sergeant (500 - 2000 Reputation Level)jlk User rank is Sergeant (500 - 2000 Reputation Level)jlk User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 10 h 41 m 53 sec
Reputation Power: 15
Quote:
Originally Posted by drgroove
XML isn't accessed directly from HTML... you need to use XSL to transform the data in your XML file into HTML...


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

Reply With Quote
  #7  
Old March 16th, 2004, 02:49 PM
drgroove's Avatar
drgroove drgroove is offline
pushing envelopes, not pencils
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Feb 2002
Posts: 6,225 drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Day 4 h 44 m 44 sec
Reputation Power: 174
Quote:
Originally Posted by jlk
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


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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > displaying xml in html


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT