Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



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?
Novice Talker

Posts: 10
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
 
 
Register now for full access!
Old 08-19-2009, 09:52 PM Re: how to write out xml format in a cgi call?
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
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

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
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.71965 seconds with 12 queries