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 October 17th, 2001, 03:19 AM
Randolph Carter Randolph Carter is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: Italy
Posts: 2 Randolph Carter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Randolph Carter
XML in a real life situation

Hello!

I read the books, I read the tutorials, I read several devshed articles on this subject, but I still find it difficult to get the pieces togheter and figure out a real life use of XML.

I have a website running with Mac OS 9.2, WebTen, FileMaker and Lasso, but in the future I will have Mac OS X, Apache, MySQL and PHP. In this site I have a section with +250 files of text. These files share the same structure (ie can share the very same DTD) and contain an extensive description of items (one file, one item). Let's say the files are like small books with same structure.

Each file is more than 75 k of text and to spare bandwith I split them in 20 sections (ie chapters), serving the right one on user request (I use Lasso includes to do this).

I also distribute these files to customers, but they don't want HMTL formatting, or better they want to use their HTML formatting. And they don't want split files.

I managed to prepare a DTD a to make a XML version of a test file (which proved well formed and valid), but now I am stuck. What do I have to do to publish my XML file on my site? I think I should use XSL, but what wizardry do I have to use to get HTML out from XML and to publish just the only section the user requests to see?

Thank you a lot for your time and help.

Reply With Quote
  #2  
Old October 17th, 2001, 02:58 PM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,711 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 6 Days 4 h 53 m 59 sec
Reputation Power: 259
Yust a little example to set you on the way:

DATA.XML

<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="mailinglist.xsl"?>
<xda>
<field>
<campo>name</campo>
<campo>surname</campo>
</field>
<Data>
<Record>
<nome>john</nome>
<cognome>smithi</cognome>
</Record>
</Data>
</xda>

DATA.XSL

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"><xsl:template match="/"><HTML><BODY><TABLE BORDER="2"><TR STYLE="font-size:8pt; font-family:Verdana; color:white; text-decoration:underline"><TD STYLE="background-colorurple">mail</TD></TR><xsl:for-each select="Data/Record"><TR STYLE="font-family:Verdana; font-size:8pt; color:black; padding:0px 6px"><TD><xsl:value-of select="mail"/></TD></TR></xsl:for-each></TABLE></BODY></HTML></xsl:template></xsl:stylesheet>

Take a look at how it transforms the xml file.
You can find good tutorials at www.ibm.com/developerworks
Hope this helps!

Reply With Quote
  #3  
Old October 17th, 2001, 05:06 PM
Randolph Carter Randolph Carter is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: Italy
Posts: 2 Randolph Carter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Randolph Carter
Thank you for your help, but I tried and I could see just an empty square...

The real problem, however, is I dont' think relying on the user's browser to parse and 'convert' xml is a good solution. We are talking about a commercial site and I don't want to loose customer just because they don't have the most updated browser. I think I would think the same also for a 'non commercial' site.

I was asking wether it is possible to convert XML to HTML on the server side (in real time or not) serving normal HTML to clients.

Again, thanks a lot for your time.

Reply With Quote
  #4  
Old October 17th, 2001, 05:16 PM
Sargant Sargant is offline
Motown Junker
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Posts: 14 Sargant User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 49 m 20 sec
Reputation Power: 0
Send a message via ICQ to Sargant Send a message via AIM to Sargant
I use PHP's XML parser to create HTML server-side from XML

It's great because PHP tags in XML don't have to output HTML, they can perform any PHP function whatsoever as well.

Guess where I learnt to do it as well? Yes... PHP with XML on DevShed

Reply With Quote
  #5  
Old October 18th, 2001, 12:49 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,711 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 6 Days 4 h 53 m 59 sec
Reputation Power: 259
Hi, I'm sorry but I made a mistake (XSL not made for this XML file, look at "value-of select="mail"/" where there is no "mail" in XML).
You can apply transformations srver side via Apache Cocoon, look for it at www.phpbuilder.com.
Good luck!

Reply With Quote
  #6  
Old October 18th, 2001, 07:28 AM
-=-steve-=- -=-steve-=- is offline
Devshed Gringo
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: Toronto, Ontario
Posts: 414 -=-steve-=- User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 12 m 20 sec
Reputation Power: 8
Exclamation

I got one...

Well I was asked today to work with docushare I have to learn XML because this the language used in the template system. I also have to create my own pages using the database...

That is one real life situation I have come by recently.

SG
__________________
echo $lol;

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XML in a real life situation


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