Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Parsing problems with t-SQL

Status
Not open for further replies.

benners70

Programmer
Nov 17, 2008
1
GB
I am struggling to read the nodes on the following feed using t-sql in SQL Server 2005:

I download it using ASP and then run the following:

DECLARE @docHandle int
DECLARE @xmlFeed XML
SELECT @xmlFeed = BulkColumn FROM OPENROWSET(BULK 'C:\Inetpub\ SINGLE_BLOB) AS x
EXEC sp_xml_preparedocument @docHandle OUTPUT, @xmlFeed
SELECT * FROM OPENXML(@docHandle, 'item', 3) WITH (link VARCHAR(250) 'link/.', title VARCHAR(250) 'title/.')

I think it's something to do with the format of the feed but I'm not sure what or how to get around it. Any help would be much appreciated.
 
>EXEC sp_xml_preparedocument @docHandle OUTPUT, @xmlFeed
>SELECT * FROM OPENXML(@docHandle, 'item', 3) WITH (link VARCHAR(250) 'link/.', title VARCHAR(250) 'title/.')

[tt]EXEC sp_xml_preparedocument @docHandle OUTPUT, @xmlFeed[red], '<root xmlns:rss="[ignore][/ignore]" xmlns:rdf="[ignore][/ignore]" />' [/red]
SELECT * FROM OPENXML(@docHandle, '[red]/rdf:RDF/rss:item[/red]', [blue]2[/blue]) WITH (link VARCHAR(250) [red]'rss:link'[/red], title VARCHAR(250) [red]'rss:title'[/red])[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top