Tuesday, September 26, 2006

web.config configuration node xmlnamespace issue

I had developed and using a data access component which readds the db configuration from app.config. Today i was told it is not working and it indeed was not able to select the db config details node. After few mins of hit-n-miss, the issue is due to xmlnamespace attrib in configuration node. Once i remove the xmlns , i was able to select the specified node

<
configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"
>
<dataConfig ...

XmlNode enterpriseLibraryDataNode = appConfigDoc.SelectSingleNode(@"/configuration/
dataConfig");

Not sure from where the dev team got this namespace from, googling a bit tells me its a VS 2005 beta release bug. Whatever the case, i hate to find a simple attribute crashing straight forward xml dom select node code.

No comments: