Showing posts with label instead. Show all posts
Showing posts with label instead. Show all posts

Monday, March 26, 2012

Load an XML doc from a file

I'm trying to do something similar to the code below, but I want to load the
XML document from a file on disk (ex.: c:\temp\mydoc.xml) instead of pasting
it into my code. Is there a way to do this in MSSQL 2005?
Thank you.
DECLARE @.idoc int
declare @.xmlDocument xml
set @.xmlDocument = N'<?xml version="1.0"?>
<gpx version="1.1"
creator="GMapToGPX 4.14 - 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.45358" lon="-110.97512">
<name>Start</name>
<ele>901.73556</ele>
</rtept>
<rtept lat="32.4537" lon="-110.97549">
<name>Turn 1</name>
<ele>902.01902</ele>
</rtept>
<rtept lat="32.45377" lon="-110.97594">
<name>Turn 2</name>
<ele>901.95196</ele>
</rtept>
<rtept lat="32.45376" lon="-110.97653">
<name>Turn 3</name>
<ele>902.22324</ele>
</rtept>
</rte>
</gpx>'
EXEC sp_xml_preparedocument @.idoc OUTPUT, @.xmlDocument, '<gpx
xmlns:gpxns="http://www.topografix.com/GPX/1/1"/>'
-- Execute a SELECT statement that uses the OPENXML rowset provider.
SELECT * FROM OPENXML (@.idoc, '/gpxns:gpx/gpxns:rte/gpxns:rtept',3)
WITH (lat float, lon float, name varchar(60) 'gpxns:name', ele float
'gpxns:ele')
Alain Quesnel
alainsansspam@.logiquel.com
www.logiquel.com
Alain Quesnel wrote:

> declare @.xmlDocument xml
> set @.xmlDocument = N'<?xml version="1.0"?>
One way is like this
SET @.xmlDocument = (
SELECT * FROM OPENROWSET(
BULK 'C:\dir\subdir\subdir\file.xml',
SINGLE_BLOB
) AS x
);
then you can use the variable @.xmlDocument as you have done before with
the stored procedure.
See the documentation here:
<http://msdn2.microsoft.com/en-us/library/ms191184.aspx>

Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/

Load an XML doc from a file

I'm trying to do something similar to the code below, but I want to load the
XML document from a file on disk (ex.: c:\temp\mydoc.xml) instead of pasting
it into my code. Is there a way to do this in MSSQL 2005?
Thank you.
DECLARE @.idoc int
declare @.xmlDocument xml
set @.xmlDocument = N'<?xml version="1.0"?>
<gpx version="1.1"
creator="GMapToGPX 4.14 - 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.45358" lon="-110.97512">
<name>Start</name>
<ele>901.73556</ele>
</rtept>
<rtept lat="32.4537" lon="-110.97549">
<name>Turn 1</name>
<ele>902.01902</ele>
</rtept>
<rtept lat="32.45377" lon="-110.97594">
<name>Turn 2</name>
<ele>901.95196</ele>
</rtept>
<rtept lat="32.45376" lon="-110.97653">
<name>Turn 3</name>
<ele>902.22324</ele>
</rtept>
</rte>
</gpx>'
EXEC sp_xml_preparedocument @.idoc OUTPUT, @.xmlDocument, '<gpx
xmlns:gpxns="http://www.topografix.com/GPX/1/1"/>'
-- Execute a SELECT statement that uses the OPENXML rowset provider.
SELECT * FROM OPENXML (@.idoc, '/gpxns:gpx/gpxns:rte/gpxns:rtept',3)
WITH (lat float, lon float, name varchar(60) 'gpxns:name', ele float
'gpxns:ele')
Alain Quesnel
alainsansspam@.logiquel.com
www.logiquel.comAlain Quesnel wrote:

> declare @.xmlDocument xml
> set @.xmlDocument = N'<?xml version="1.0"?>
One way is like this
SET @.xmlDocument = (
SELECT * FROM OPENROWSET(
BULK 'C:\dir\subdir\subdir\file.xml',
SINGLE_BLOB
) AS x
);
then you can use the variable @.xmlDocument as you have done before with
the stored procedure.
See the documentation here:
<http://msdn2.microsoft.com/en-us/library/ms191184.aspx>
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/|||Works like a charm.
Thank you,
Alain Quesnel
alainsansspam@.logiquel.com
www.logiquel.com
"Martin Honnen" <mahotrash@.yahoo.de> wrote in message
news:OLcWpOogHHA.2368@.TK2MSFTNGP04.phx.gbl...
> Alain Quesnel wrote:
>
> One way is like this
> SET @.xmlDocument = (
> SELECT * FROM OPENROWSET(
> BULK 'C:\dir\subdir\subdir\file.xml',
> SINGLE_BLOB
> ) AS x
> );
> then you can use the variable @.xmlDocument as you have done before with
> the stored procedure.
> See the documentation here:
> <http://msdn2.microsoft.com/en-us/library/ms191184.aspx>
>
> --
> Martin Honnen -- MVP XML
> http://JavaScript.FAQTs.com/

Friday, March 23, 2012

lists

Does anyone know if it is possible to have the text in lists to be displayed
horizontally (left to right) instead of vertically.
This is what I have:
3a
2b
1C
But this is what I need:
3a 2b 1c
Please let me know if this is possible, and how I can accomplish this if it
is possible.
Thank you.use the matrix instead of the table object
"dataGirl" <dataGirl@.discussions.microsoft.com> wrote in message
news:56EB68E3-2BC7-40A4-9EBE-D42CFA5593C4@.microsoft.com...
> Does anyone know if it is possible to have the text in lists to be
> displayed
> horizontally (left to right) instead of vertically.
> This is what I have:
> 3a
> 2b
> 1C
> But this is what I need:
> 3a 2b 1c
> Please let me know if this is possible, and how I can accomplish this if
> it
> is possible.
> Thank you.|||Thanks Dean. Under normal circumstances (if the list was a stand alone list)
I can see how this would work. However, the list that I have is actually
inside one of the columns on an existing table. When I put the matrix inside
of the column in place of the list, it pushes the column so far to the right
that the formatting dosen't really look all that good anymore. But thanks
for responding...even though I should have given more information in my
initial post! I'll keep trying to see what else can be done. Thanks again
for the help.
"Dean" wrote:
> use the matrix instead of the table object
> "dataGirl" <dataGirl@.discussions.microsoft.com> wrote in message
> news:56EB68E3-2BC7-40A4-9EBE-D42CFA5593C4@.microsoft.com...
> > Does anyone know if it is possible to have the text in lists to be
> > displayed
> > horizontally (left to right) instead of vertically.
> >
> > This is what I have:
> > 3a
> > 2b
> > 1C
> >
> > But this is what I need:
> > 3a 2b 1c
> >
> > Please let me know if this is possible, and how I can accomplish this if
> > it
> > is possible.
> >
> > Thank you.
>
>