XML XSLT Namespace gotcha

Challenge:

Before couple of weeks back we spent a good amount of time making XML and XSLT work, you must be thinking so easy then why this guy invested lot of time. Wait o minute coming to you.

Solution:

Basically, we had XML and we were trying to fetch few nodes via XSLT from it. But it was not working as expected. We verified everything our XPATH was correct and everything was correct then following link, pointed us towards a solution:
http://stackoverflow.com/questions/1730875/xslt-transform-xml-with-namespaces
Our XML was having xmlns deceleration,  and we were not using xmlns in our XSLT document. And that was the reason why XSLT was not able to XPATH nodes. Once, we added XMLNS to our XSLT document and changed our XPATH as per XMLNS then everything started working as expected!

Fast and furious way to LoadXML document

Challenge:

While loading XMLDocument using LoadXML method we found that sometimes it takes a long time to load xml. Is is a same challenge you are facing? Then this post is for you!

Solution:

http://codinglight.blogspot.in/2009/06/how-to-load-xmldocument-and-completely.html
This article helped us to do so! Basically, when you hit LoadXml Method it, internally validates XML by loading it’s DTD — and if your DTD server is busy it may take time to load.
So, the solution (If it is not breaking your functionality) is set XmlReaderSetting’s — Set XmlResolver to null, and ProhibitDtd to false.
That’s it!
Happy XML Loading! 🙂

EXECUTE permission denied on object ‘ABC’, database ‘XYZ’, schema ‘dbo’.

Error:

EXECUTE permission denied on object ‘usp_GetEmployeeDetails’, database ‘Employee’, schema ‘dbo’.

Solution:

  1. Expand your database Node. For me it’s “Employee”.
  2. Underneath of it Expand “Security” Node.
  3. Click on the user which you are using for Database operations. By default it is

MACHINENAME\ASPNET [MYMACHINE\ASPNET].

  1. It will open the window as shown below from database Roles Select db_owner:

clip_image002

That’s it…