473,395 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to Return pure XML (no WS)

Hi,
I've to return an XML (a KML for Google Earth) from my Web Server. How can I
do it with ASP.NET 2.0???
These are the requirements for a "KML Server" as stated by Google:
KML Server requirements
When responding to a request from the Google Earth client, a KML server must
follow a certain set of rules so that the client can correctly interpret
responses.

Upon success, the server must return a response code of HTTP 200 and set the
response's content-type to a suitable MIME type.
Google Earth reads KML and KMZ files, and the MIME types for these are:
application/vnd.google-earth.kml+xml kml
application/vnd.google-earth.kmz kmz
The body of the response must contain valid KML data, including the xml
declaration header (<?xml version="1.0" encoding="UTF-8"?>). If the server
returns invalid KML, the Network Link will stop deactivate and output an
error message.

Thanks,
Stefano
Jan 31 '06 #1
3 3737
Create an HttpHandler that sets the Response.ContentType to the proper MIME
type and does a Response.Write of the output xml.

HTH,

Matt Dinovo

"Stefano Peduzzi" <pe***@interfree.it> wrote in message
news:up***************@tk2msftngp13.phx.gbl...
Hi,
I've to return an XML (a KML for Google Earth) from my Web Server. How can
I do it with ASP.NET 2.0???
These are the requirements for a "KML Server" as stated by Google:
KML Server requirements
When responding to a request from the Google Earth client, a KML server
must follow a certain set of rules so that the client can correctly
interpret responses.

Upon success, the server must return a response code of HTTP 200 and set
the response's content-type to a suitable MIME type.
Google Earth reads KML and KMZ files, and the MIME types for these are:
application/vnd.google-earth.kml+xml kml
application/vnd.google-earth.kmz kmz
The body of the response must contain valid KML data, including the xml
declaration header (<?xml version="1.0" encoding="UTF-8"?>). If the server
returns invalid KML, the Network Link will stop deactivate and output an
error message.

Thanks,
Stefano

Jan 31 '06 #2
Response.ContentType="application/vnd.google-earth.kml+xml kml";
XmlDocument doc = new XmlDocument();
doc.LoadXml("your Xml document string here"); // or use doc.Load overload
Response.Write (doc.OuterXml);
Response.End();

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Stefano Peduzzi" wrote:
Hi,
I've to return an XML (a KML for Google Earth) from my Web Server. How can I
do it with ASP.NET 2.0???
These are the requirements for a "KML Server" as stated by Google:
KML Server requirements
When responding to a request from the Google Earth client, a KML server must
follow a certain set of rules so that the client can correctly interpret
responses.

Upon success, the server must return a response code of HTTP 200 and set the
response's content-type to a suitable MIME type.
Google Earth reads KML and KMZ files, and the MIME types for these are:
application/vnd.google-earth.kml+xml kml
application/vnd.google-earth.kmz kmz
The body of the response must contain valid KML data, including the xml
declaration header (<?xml version="1.0" encoding="UTF-8"?>). If the server
returns invalid KML, the Network Link will stop deactivate and output an
error message.

Thanks,
Stefano

Jan 31 '06 #3
Hello Stefano,
Hi,
I've to return an XML (a KML for Google Earth) from my Web Server. How
can I
do it with ASP.NET 2.0???
These are the requirements for a "KML Server" as stated by Google:
KML Server requirements
When responding to a request from the Google Earth client, a KML
server must
follow a certain set of rules so that the client can correctly
interpret
responses.
Upon success, the server must return a response code of HTTP 200 and
set the
response's content-type to a suitable MIME type.
Google Earth reads KML and KMZ files, and the MIME types for these
are:
application/vnd.google-earth.kml+xml kml
application/vnd.google-earth.kmz kmz
The body of the response must contain valid KML data, including the
xml
declaration header (<?xml version="1.0" encoding="UTF-8"?>). If the
server
returns invalid KML, the Network Link will stop deactivate and output
an
error message.


The best approach is to implement a HttpHandler that sets HttpResponse.ContentType
to one of those mentioned above and writes KML to your HttpResponse's OutputStream.
There's really nothing special here.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Jan 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: santosh | last post by:
Hello, I was going through the Marshal Cline's C++ FAQ-Lite. I have a doubt regarding section 33.10. Here he is declaring a pure virtual destructor in the base class. And again defining...
13
by: junky_fellow | last post by:
I have read certain articles that encourage to use/write pure functions (if possible) as they are better suited for optimization. I got one example that expalins how the code can be optimised....
6
by: pakis | last post by:
I am having a problem of pure virtual function call in my project. Can anyone explaine me the causes of pure virtual function calls other than calling a virtual function in base class? Thanks
22
by: Michael Rasmussen | last post by:
Hi all, Not sure if this is OT? I have a function in a library written in C++ which returns a strdup(s.c_str()) to an application written i C. Running Valgrind on my C-application shows this...
25
by: Christian Christmann | last post by:
Hi, the ANSI-C 99 standard specifies that the main function has "int" as return type. However, there are still lots of people declaring "void" as main return type. Did previous ANSI-C...
5
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I have a class that is writen in unmanaged pure native C++. This class files (h and cpp) are inserted to a managed C++ (VC++ 2005, C++/CLI) DLL compoenet. This DLL compoenet is used in a C#...
6
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it...
68
by: Jim Langston | last post by:
I remember there was a thread a while back that was talking about using the return value of a function as a reference where I had thought the reference would become invalidated because it was a...
6
by: herzog | last post by:
Hi, I am using C# to a draw a graphic on a memory bitmap. I then extract the color information of every pixel of the bitmap. I do this with Bitmap.GetPixel(). The trouble I'm having is that I...
14
by: Jack | last post by:
Hi, I meet a question with it , I did not get clear the different betteen them, for example: #include <iostream>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.