Reply
how to write out xml format in a cgi call?
Old 08-19-2009, 04:53 PM how to write out xml format in a cgi call?
Junior Talker

Posts: 4
Trades: 0
Hi, I'm new to xml. I have a cgi application which writes out a html page. Now I need to display the page with xml tag. So my cgi code takes an input, and writes out

Code:
    cout<<"Content-TYPE: text/html\n\n";
    cout<<"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
    cout<<"<disease cnt=\"2\">\n";
       cout<<"<name>heart disease</name>\n";
       cout<<"<name>breast disease</name>\n";
    cout<<"</disease>\n";
At the web site
h..p://......./disease.cgi?term=heart+disease+breast+disease
It only displays "heart disease breast disease" on one line.
If I save the ouput to a file test.xml, it displays

<disease cnt="2">
<name>heart disease</name>
<name>breast disease</name>
</disease>

This is the display I want. How to get this display by calling that cgi program?
Thanks a lot for any help!!!
hpdp is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 08-19-2009, 09:52 PM Re: how to write out xml format in a cgi call?
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 1,470
Name: Jeremy Miller
Location: Marianna, FL
Trades: 0
You're displaying the code like it's HTML (see the content-type?). That means that the "disease" and "name" tags are treated as HTML instead of XML and therefore not displayed to the end user. Change them to &lt; and &gt; to ensure that they display the character.
__________________
Jeremy Miller - TeraTask
Content Farmer - Automated Posting for Content & Blog Sites
JeremyMiller is online now
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to how to write out xml format in a cgi call?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.10791 seconds with 13 queries