Problem with OPENXML



I'm trying to open an XML file with OPENXML. I keep getting the following
error:
The error description is 'The following tags were not closed: gpx, rte,
rtept.'

This is the full script:


DECLARE @idoc int
DECLARE @doc varchar(1000)
SET @doc =
'<?xml version="1.0"?>
<gpx version="1.1"
creator="GMapToGPX 4.13 - http://www.elsewhere.org/GMapToGPX/";
xmlns="http://www.topografix.com/GPX/1/1";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.topografix.com/GPX/1/1
http://www.topografix.com/GPX/1/1/gpx.xsd";>
<rte>
<name>Gmaps Pedometer Route</name>
<cmt>Permalink: <![CDATA[
Permalink temporarily unavailable.
]]>
</cmt>
<rtept lat="32.02686" lon="-111.57748">
<name>Start</name>
<ele>983.8883</ele>
</rtept>
<rtept lat="32.02384" lon="-111.577">
<name>Turn 1</name>
<ele>992.36174</ele>
</rtept>
<rtept lat="32.02074" lon="-111.57645">
<name>Turn 2</name>
<ele>1000.02746</ele>
</rtept>
<rtept lat="32.0176" lon="-111.5759">
<name>Turn 3</name>
<ele>1008.78741</ele>
</rtept>
<rtept lat="32.01447" lon="-111.57535">
<name>Turn 4</name>
<ele>1018.70256</ele>
</rtept>
</rte>
</gpx>'
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
-- Execute a SELECT statement that uses the OPENXML rowset provider.
SELECT *
FROM OPENXML (@idoc, '/gpx/rte/rtept',1)
WITH (lat float,
lon float)


Thank you,

--

Alain Quesnel
alainsansspam@xxxxxxxxxxxx

www.logiquel.com


.



Relevant Pages

  • Re: JDBC vs Hibernate
    ... I read somewhere that OPENXML is faster, (I have the XML file in memory already, my application is generating an XML file) ... "INSERT DataSource SELECT * FROM OPENXML(@_hDoc, ...
    (comp.lang.java.databases)
  • Re: What is fastest way to insert many records into a SQL server database?
    ... To use OPENXML do I have to output an XML file to be imported by SQL Server ... (in much the same way as the BULK INSERT method) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: HOW I CAN SAVE AN XML IN SQL SERVER
    ... Do you want to shred it into rows/columns or store it as blob? ... If you want to shred it, you may use OpenXML or Dataset. ... consider using Bulkload which will stream the date to SQL server. ... >I HAVE AN APP THAT RECEIVE FROM THE WEB A XML FILE ...
    (microsoft.public.sqlserver.xml)
  • OPENXML
    ... Is there a way to use read data from an XML file, ... The code example below is from BOL using OPENXML, ... EXEC sp_xml_preparedocument @hDoc OUTPUT, ... INSERT Customers ...
    (microsoft.public.sqlserver.programming)