MS SQl + XML parsing error: Reference to undeclared namespace prefix

When a namespace is declared in your xml document / String and you will use the OpenXml in your stored Procedure / Sql Query, you will get this type of error. To remove this error you need to define the namespace while you write the EXECUTE statement in you query/stored procedure.

Suppose you have written the following statement:

EXEC sp_xml_preparedocument @docHandle OUTPUT, @XmlDoc

So you need to change it with the following one:

EXEC sp_xml_preparedocument @docHandle OUTPUT, @XmlDoc, ‘’

Where ns0 is the namespace of your xmlDocument, which is defined in the first node of your xml document. Suppose my xml document is as follows:

ID_0
Name_0
Address_0
City_0

Let me know if you have any query:)

Regards,
Vijay Modi

Advertisements

About Vijay Modi

Having 12+ years of experience in web application development. Expertise in various domains like E-Commerce, E-Learning, Insurance. I have expertise in web application development, window application development, Performance improvement, bug fixing etc. I am believing in quality work and achieving deadlines. Also like to work on new technologies and quick learner.
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

3 Responses to MS SQl + XML parsing error: Reference to undeclared namespace prefix

  1. Jigar C says:

    Can u put some Interesting Topic in .Net, Not every time put Error which u faced,

  2. Vijay Modi says:

    Hi Jigar,

    Right now I am working on Biztalk. And on net I am not finding such solutions. And I resolved some errors my own. So I think to keep it on Net as others time donot waste. I will write some interesting topic soon. Sorry for such type of articles. Currently I am busy, once I will get some time, I will write good article on .net too.

    Regards,
    Vijay Modi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s