Home > Archive > MS SQL XML > December 2005 > How to create an xml schema collection from a file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to create an xml schema collection from a file
André Gil

2005-12-27, 11:23 am

Hello all.

I'm trying to create an xml schema collection from a file, using this code

DROP XML SCHEMA COLLECTION gandy
DECLARE @xml xml
SELECT @xml = BulkColumn FROM openrowset(Bulk 'P04-S01.xsl', SINGLE_BLOB) as x
CREATE XML SCHEMA COLLECTION gandy AS @xml

The problem is that after running this statements SQL Server 2005 gives this
error

Msg 2378, Level 16, State 1, Line 4
Expected XML schema document

What is the problem?

The xslt document is well formed and working (I used it with Altova XML Spy
to apply the transformation).

Thanks

André Gil
Hilary Cotter

2005-12-27, 1:23 pm

try something like this

declare @string varchar(MAX)
declare @xml varchar(MAX)
select @string ='Create xml Schema Collection MySchemaCollections as '''
SELECT @xml = replace(BulkColumn,C
HAR(39),CHAR(39)+CHA
R(39)) FROM
openrowset(Bulk ''P04-S01.xsl'', SINGLE_BLOB) as x
select @string=@string +@xml +''''
--print @string
exec(@string)

I am not sure about the wisdom of doing something like this though.

--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com

"André Gil" <AndrGil@discussions.microsoft.com> wrote in message
news:8E8AB17D-4D56-442B-A9D1- 0459E86A1215@microso
ft.com...
> Hello all.
>
> I'm trying to create an xml schema collection from a file, using this code
>
> DROP XML SCHEMA COLLECTION gandy
> DECLARE @xml xml
> SELECT @xml = BulkColumn FROM openrowset(Bulk 'P04-S01.xsl', SINGLE_BLOB)
> as x
> CREATE XML SCHEMA COLLECTION gandy AS @xml
>
> The problem is that after running this statements SQL Server 2005 gives
> this
> error
>
> Msg 2378, Level 16, State 1, Line 4
> Expected XML schema document
>
> What is the problem?
>
> The xslt document is well formed and working (I used it with Altova XML
> Spy
> to apply the transformation).
>
> Thanks
>
> André Gil



Michael Rys [MSFT]

2005-12-28, 3:24 am

Interrupting my skiing :-)

Why would you want to load an XSLT transformation as a schema file? They
have nothing in common.

Try loading an actual XML Schema file....

Best regards
Michael

"André Gil" <AndrGil@discussions.microsoft.com> wrote in message
news:8E8AB17D-4D56-442B-A9D1- 0459E86A1215@microso
ft.com...
> Hello all.
>
> I'm trying to create an xml schema collection from a file, using this code
>
> DROP XML SCHEMA COLLECTION gandy
> DECLARE @xml xml
> SELECT @xml = BulkColumn FROM openrowset(Bulk 'P04-S01.xsl', SINGLE_BLOB)
> as x
> CREATE XML SCHEMA COLLECTION gandy AS @xml
>
> The problem is that after running this statements SQL Server 2005 gives
> this
> error
>
> Msg 2378, Level 16, State 1, Line 4
> Expected XML schema document
>
> What is the problem?
>
> The xslt document is well formed and working (I used it with Altova XML
> Spy
> to apply the transformation).
>
> Thanks
>
> André Gil



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com