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 July 27th, 2004, 02:01 PM
user# 63632 user# 63632 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 10 user# 63632 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Pulling data from a mySQL db using PHP and displaying it as XML

So, I'm pretty new to XML. I'm following the tutorial on http://ils.unc.edu/~sedac/inls259/DTD.html and also using http://www.w3schools.com/dtd/dtd_intro.asp because the explanation is simpler. I can replicate the XML example on the first link by copying the DTD, XSL and XML files onto my web space, but I can't seem to change the tags to get it to work with what I'm doing. I'm trying to start out with a simple one-tier structure - release being the root element and date and headline being the other elements.

Here is my releases.dtd file:
Code:
<!ELEMENT release (date,headline)>
<!ELEMENT date (#PCDATA)>
<!ATTLIST date e-dtype NMTOKEN  #FIXED 'string'>
<!ELEMENT headline (#PCDATA)>
<!ATTLIST headline e-dtype NMTOKEN  #FIXED 'string'>


output.xsl:
Code:
<?xml version="1.0" encoding="UTF-8" ?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title>untitled</title>
</head>
<body bgcolor="#8FACC7" text="#ffffff" link="#808040">
<xsl:for-each select="date">
<p class='releases'>
<xsl:value-of select="date"/>
</p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


and output.xml:
Code:
<?xmlversion ="1.0"?>
<?DOCTYPE release SYSTEM "releases.dtd"?>
<?xml-stylesheet href="output.xsl" type="text/xsl"?>
<release>
	<date>JULY 10, 1994</date>
	<headline>TEST HEAD</headline>
</release>


The output.xml displays a blank page with bgcolor color specified in the xsl stylesheet, so I think that's fine. I'm just having trouble grasping how to write the DTD, so I suspect that's my main problem. What could I be doing wrong? Thanks for any help.

Reply With Quote
  #2  
Old July 28th, 2004, 12:56 PM
user# 63632 user# 63632 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 10 user# 63632 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ok, I figured that much out, now my question is how to pull the information from a mysql database. I'm using PHP pages but the link above only gives an example of how to do it with ASP. I've tried changing some things around but I still get the error on line 1. My first three lines are:

<?xmlversion "1.0"?>
<!DOCTYPE Directory SYSTEM "releases2.dtd">
<?xml-stylesheet href="xml2.xsl" type="text/xsl"?>

Can these not go in a PHP file?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Problems with my DTD (I think)


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
Stay green...Green IT