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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old November 26th, 2003, 07:52 AM
WorldBuilder's Avatar
WorldBuilder WorldBuilder is offline
Big Daddy
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Sep 2003
Location: Boston
Posts: 1,470 WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 4 h 53 m 8 sec
Reputation Power: 20
Send a message via AIM to WorldBuilder
NEW to xml, not binding in an html page. Apache?

Hi all,

I am a complete XML NEWBIE, so please bear with me if these questions are dumb.

I just wrote my very first xml file ever. I am making a list of all of my mp3's so I can post them on my site. I think I binded it to the html properly, but perhaps not because when I go to the site, all I get is a small box. Here's the url:

http://www.bartlett-family.net/chris/hobbies/

I attached the xml document, and have provided the html code here.
Code:
<html>
<body>
<xml id="cdcat" src="music.xml"></xml>
<table border="1" datasrc="#cdcat">
<tr>
<td><span datafld="ARTIST"></span></td>
<td><span datafld="TITLE"></span></td>
</tr>
</table>
</body>
</html>


Both of these files (the html and xml files) are in the same server directory. Is there something I need to do to may Apache server to permit xml documents, or is the server irrelevant completely? Again, I'm a xml newbie! Thanks, fellas!
Attached Files
File Type: xml music.xml (4.9 KB, 132 views)
__________________
Pop, pop, fizz, fizz, oh what a relief it is!

Reply With Quote
  #2  
Old November 26th, 2003, 11:20 AM
WorldBuilder's Avatar
WorldBuilder WorldBuilder is offline
Big Daddy
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Sep 2003
Location: Boston
Posts: 1,470 WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 4 h 53 m 8 sec
Reputation Power: 20
Send a message via AIM to WorldBuilder
NM, I figured it out!

Chris

Reply With Quote
  #3  
Old November 26th, 2003, 11:32 AM
tsprings tsprings is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Seattle, WA
Posts: 55 tsprings User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 20 sec
Reputation Power: 5
Hello cjwsb. You weren't too far off in your guess about "not binding the file to the xml"... Since you are a newbie, perhaps you don't understand that if you want to view your XML data, you should really do it as an XSL transformation. You probably have no clue what that is, so visit http://www.w3schools.com/xsl for more info.

In short, an XSL tranformation is a way to view your XML file through the use of HTML. So you write your xml file, and link it to the XSL by putting something like this at the top of your xml file, after the XML declaration: <?xml-stylesheet type="text/xsl" href="music.xsl" ?>. The music.xsl file is the file that contains the information on transforming the XML document.

Again to clarify, you're not viewing your XSL document or an HTML document, rather you're viewing the XML document and the transformation is happening automatically. (You can do client side or server side transformations, but let's not get into that right now.)

I created two implementations of the XSL code, with the latter being my prefered method, as I believe it allows for greater versitility in the future, (say you want to arrange them alphabetically, etc).

If I wanted to take your html code and make it an XSL, it would look like this:

music.xsl
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>
  <head>
  </head>
  <body>
    <xml id="cdcat" src="music.xml"></xml>
    <table border="1" datasrc="#cdcat">
      <tr>
        <td><span datafld="ARTIST"></span></td>
        <td><span datafld="TITLE"></span></td>
      </tr>
    </table>
  </body>
</html>
</xsl:template>
</xsl:stylesheet>


If you are new to XML and XSL though, this is rather confusing, and is not very standard to what W3 Schools recommends for transformations. So here is my version of the XSL.

music.xsl
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>
<head>
  <!-- You can do the CDATA as you had it, but that is
       rather complicated.  This is a more standard XSL
       transformation.  Visit http://www.w3schools.com/xsl
       to learn more about XSL and XML. -->
</head>
<body>
   <table border="1">
     <xsl:for-each select="CATALOG/CD">
       <tr>
         <td><xsl:value-of select="ARTIST" /></td>
         <td><xsl:value-of select="TITLE" /></td>
       </tr>
     </xsl:for-each>
   </table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


And here is a truncated XML file just to clear up any potential confusion, notice the link to musix.xsl:
music.xml
Code:
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="music.xsl" ?>
  <CATALOG>

  <CD>
  <TITLE>Empire Burlesque</TITLE> 
  <ARTIST>Bob Dylan</ARTIST> 
  <COUNTRY>USA</COUNTRY> 
  <COMPANY>Columbia</COMPANY> 
  <PRICE>10.90</PRICE> 
  <YEAR>1985</YEAR> 
  </CD>

  <CD>
  <TITLE>Hide your heart</TITLE> 
  <ARTIST>Bonnie Tyler</ARTIST> 
  <COUNTRY>UK</COUNTRY> 
  <COMPANY>CBS Records</COMPANY> 
  <PRICE>9.90</PRICE> 
  <YEAR>1988</YEAR> 
  </CD>

  </CATALOG>

Reply With Quote
  #4  
Old November 26th, 2003, 01:18 PM
WorldBuilder's Avatar
WorldBuilder WorldBuilder is offline
Big Daddy
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Sep 2003
Location: Boston
Posts: 1,470 WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 4 h 53 m 8 sec
Reputation Power: 20
Send a message via AIM to WorldBuilder
Thanks for the reply, tsprings!

I am learning more and more. I did get it working, man. Thanks for the tips!

Chris

Last edited by cjwsb : November 26th, 2003 at 01:52 PM.

Reply With Quote
  #5  
Old November 26th, 2003, 07:19 PM
WorldBuilder's Avatar
WorldBuilder WorldBuilder is offline
Big Daddy
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Sep 2003
Location: Boston
Posts: 1,470 WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level)WorldBuilder User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 4 h 53 m 8 sec
Reputation Power: 20
Send a message via AIM to WorldBuilder
Hi again, guys...

I "finished" setting up my xml list at http://www.bartlett-family.net/chris/hobbies

Other than having laughable, archaic code (let's keep the laughter to a minimum, I'm not going for a gold star here ), I am pleased with how it looks.

The only other thing I would like to do is to actually have the song TITLES be links that go to the mp3 file itself. Where would I place the anchor? In the xml somehow? In the html somehow? How do I do this? Thanks!

Chris

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > NEW to xml, not binding in an html page. Apache?


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 5 hosted by Hostway