List Info

Thread: Need help with asp.net code




Need help with asp.net code
user name
2006-02-28 15:37:15
I have added my code for the review.......

Hi,

I have a web service which converts data from SQL Server to
an XML
file.
This project is in a very early stage. This is also my first
XML
related project. So please bear in mind that I am XML
challenged
person.


The output that I would like to get is something like
this...


<?xml version="1.0"
encoding="UTF-8"?>
<kml xmlns="http://earth.google.c
om/kml/2.0">
<Folder>
        <Placemark>
                <name>name1</name>
                <address>address1</address>
        </Placemark>
        <Placemark>
                <name>name2</name>
                <address>address2</address>
        </Placemark>
</Folder>
</kml>


I have a XSD file which I load into dataset before doing
dataset.getxml


    <WebMethod()> _
    Public Function getdata() As String
        Try
            Dim strSql As String
            Dim cnLocal As New
SqlConnection("connectionstring")
            Dim dsGoog As New DataSet("dsGoog")
           
dsGoog.ReadXmlSchema("\xml2scm.xsd")
            strSql = "SELECT name, address FROM
table1"
            Dim daGoog As New SqlDataAdapter(strSql,
cnLocal)
            daGoog.Fill(dsGoog)
            Return dsGoog.GetXml
            dsGoog.Dispose()
            cnLocal.Close()
        Catch ex As Exception

        End Try
    End Function



But the output XML that I get is not according to the KML
format
defined in XSD file.


The output I get is like this.....


<?xml version="1.0"
encoding="utf-8" ?>
<string xmlns="http://earth.google.c
om/kml/2.0">
<NewDataSet>
        <Table>
                <name>name1</name>
                <address>address1</address>
        </Table>
        <Table>
                <name>name2</name>
                <address>address2</address>
        </Table>
</NewDataSet>
</string>


What do I need to do to get the XML/KML in the right format?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "google earth" group.
To post to this group, send email to google-earthgooglegroups.com
To unsubscribe from this group, send email to
google-earth-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/google-earth
-~----------~----~----~----~------~----~------~--~---

Need help with asp.net code
user name
2006-03-01 08:20:46
Your problem is that you are writing the DataSet to your
attempted KML
file. What you need to do is to step through all your rows
and add them
to your KML - I would recommend an XMLWriter.

BTW, your KML is not properly formatted. Look here
(htt
p://www.reimers.dk/atlas/instructions.aspx#kml) for the
markup I
use for the ASP.NET map here (http://www.reime
rs.dk/atlas/map.aspx)
that reads/writes KML directly compatible with Google Earth.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "google earth" group.
To post to this group, send email to google-earthgooglegroups.com
To unsubscribe from this group, send email to
google-earth-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/google-earth
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )