.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Can I opt to ignore namespaces?

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :


I am using XML functions in T-SQL to parse a series of XML document. The trouble is that these messages can have one of a range of namespaces and there is no way of knowing ahead of time which namespace is being used as the default. Hence I have some code that looks like this:

DECLARE @vMessageType NVARCHAR(128);
SET @vMessageType = @pMessage.value('declare default element namespace "http://tempuri.net/namespace1";
IF @vMessageType = ''
	SET @vMessageType = @pMessage.value('declare default element namespace "http://tempuri.net/namespaec2";	local-name((/Messages/*[1])[1])','nvarchar(128)');
IF @vMessageType = ''
	SET @vMessageType = @pMessage.value('declare default element namespace "http://tempuri.n

View Complete Post

More Related Resource Links

Security: Protect Private Data with the Cryptography Namespaces of the .NET Framework


The .NET Framework includes a set of cryptographic services that extend the services provided by Windows through the Crypto API. In this article, the author explores the System.Security.Cryptography namespace and the programming model used to apply cryptographic transformations. He discusses reasons why cryptography is easier in .NET than it was before, including the easy programmatic acccess developers have to the cryptography APIs and the difference between symmetric and asymmetric algorithms. Along the way, a brief discussion of the most widely used algorithms, including RSA, DSA, Rijndael, SHA, and other hash algorithms, is provided.

Dan Fox

MSDN Magazine June 2002

V1.1 to Beta 2 - Namespaces Not Recognized


We are attempting to test out a website written in VS2003/.Net 1.1 in VS2005 Beta 2/.Net 2.0.  Our main problem at this point is that certain classes are not being recognized when they are referenced in other files not in the same directory as the class file.


A Framework.cs file under \Applications is inherited by several other webpages. It resides under the namespace Company.WebSite.Applications.

Another class, SearchHistories, is in \Applications\CrackHistory directory. The namespace of SearchHistories class is Company.WebSite.Applications.CrackHistory. SearchHistories inherits Framework.  Under .NET1.1, there was no problem with this. However, in VS2003, a compile error states "The type or namespace name 'Framework' could not be found (are you missing a using directive or an assembly reference?) C:\WEB\Applications\CrackHistory\SearchHistories.aspx.cs".

The immediate solution is to copy the Framework.cs file from the Applications directory and copy it into the Applications\CrackHistory directory. Then the error goes away. What is up with that?

Removing Xml Namespaces from XmlSerialization

I am currently using Xml Serialization to serialize my classes in Visual Studio 2010, but I have been unable to remove the default namespaces that get attached to my document. These two elements get attached to the root of my document each time. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" When I specify my XmlRoot attribute on my class, I have tried both methods: [XmlRoot("requestor", Namespace="")] as well as <pre lang="x-c#">[XmlRoot("requestor")] Both of these methods have continued to result in the namespace being appended to my XmlDocument. This is currently the method I have been calling for my Xml Serialization: <pre lang="x-c#">/// <summary> /// Performs XmlSerialization of a particular object/class /// using the .Net Xml Serializer /// </summary> /// <param name="objForSerialization">object or class instance to be serialized</param> /// <returns>string containing the serialized object in Xml Document format</returns> public static string XmlSerialize(object objForSerialization) { string strSerialized = string.Empty; using (MemoryStream memoryStream = new MemoryStream()) { XmlSerializer serializer = new XmlSerializer(objFo

what's the right collation for sql server 2008 to ignore french accent?

I want to  sql server 2008 collation using english as default(in Canada). when search for text, french accent can be ignore. For example, À,Â,Ä, à, â, ä will be treated same as a or A, but the data still is stored as different(such as for key). so what is the right collation need to be selected when install sql server 2008?. If existing instance collation is not the right one, how to change it to the right one?


Hi,A rather basic question coming up, but it does say no question too simple.I am coding for the first time in .net and looking at namespaces and classes.  If had a look on the web but I'm still not totally clear on right approach to structuring them.For instance:If I have 2 classes, called EmailTemplate and EmailSender, how would I structure this?  Do I do this...in the first class namespace Email { class EmailSender { } } then in the second class namespace Email { class EmailTemplate { } } or am I getting it totally wrong?Any advice would be apprceciatedJohn

A call to SSPI failed: The target principal name is incorrect - How to ignore this Security Check

I find that I am getting this error since I am using the netTCPBinding. I don't get this exception when the client and server are on the same machine, but when they are on different machines, this exception occurs. If I set the identity on the end point as mentioned in the article: http://blogs.msdn.com/b/drnick/archive/2007/11/08/setting-a-user-principal-on-the-endpoint.aspx it is working fine.   So my question is , should the service end point always have an identity when using netTcpBinging? I tried setting Security.Mode = None and still I got this identity exception. is there any way through which I can ask the service to ignore the SSPI details and accept client request?   Thanks!

Ignore Validaterequest on 1 button...

 I've got a ajax page with 2 panels on it.On Panel1 there is a next button. On that panel there is a pref. button and a next button.But if i put the pref. button he should do an action, but thats not possible because there are requestedfieldvalidators on that page. So i need to fill the page first, and then i can go back.But on the next i want the validators. How can i make this possible?

Ignore javascript error in modeless dialog

my problem is: 1. in Internet Option, i check Disable script debugging (Internet Explorer) and uncheck Display a notification about every script error 2. in my program, i open a Modeless dialog and have a script error in Modeless dialog my problem is Why i checked Disable script debugging (Internet Explorer) and Display a notification about every script error option, but error message still display? May i ignore javascript error in modeless dialog? thanks for your support!    

Resource is ambiguous,imported from the namespaces or types 'System,System.web

Hi, I have one project in TFS and once i get latest version it gives following error. "Resource is ambiguous,imported from the namespaces or types 'System,System.web'"   Even i have checked twice that there is no duplication but still giving error.   Please help me on same. Thanks in advance 

Ignore exception made by COM object?

Hi, I have third party COM object that I reference into my project. My project was simple console application which source code similar like code below: static void Main(string[] args) { try{ object _comObject = new ComObject(); // do some stuff with _comObject. while (Marshal.ReleaseComObject(_comObject) > 0) { } _comObject = null; } catch { } } I have put try..catch wrap around my Main function and also release COM resources that lock by object. But still COM throw an exception of Invalid Window Handle and made my application to stuck until user click the OK button on error message. Now the problem was why the try..catch not function, if there any exception throw by COM object it should catch by try..catch block. So this point the COM error raised after the try..catch block which mean the exception raised after my application send closed signal to OS. And the bad news is the COM exception is under my application and it made my application stuck (not closed) until the error dialog is closed. I don't want the exception to show up (made my application stuck), that's why I wrap my Main function with try..catch. I just need my application closed. Is there any way to unload the referenced COM library just before application closed (like DllUnload on Native programming), so I can wrap it with try..catch to ignore exception message that made by COM objec

Ignore a parameter values ??

Hello I will briefly describe my problem, I have a report as a matrix where the years are presented in columns and below these years we find months, the report accepts as parameter the year and month and other params, I'd like under the choice of an user to display either the years and months at a time or Only the years. I tried as a solution to add a new value = "Ignore months" to the parameter "month " but when i try to view the report, it does not display anything (because it filters month which = 'Ignore months ' and finds no result) So there is a way to ignore the month parameter values in this case??? Hope to get response as soon as possible.Thank you Regards Aya

Why does the engine ignore my Cross Apply?

I'm a beginner attempting to understand cross apply. Suppose I have a Numbers table with only one column: DECLARE @Nums Table(Num int) INSERT INTO @Nums (Num) Values (5) INSERT INTO @Nums (Num) Values (6) INSERT INTO @Nums (Num) Values (7) The following produces two columns of output (in SSMS Express 2005). SELECT  * FROM @Nums         CROSS APPLY         (             SELECT  Num * 2 as Doubled         ) as NewTable Now let's change the SELECT * to  SELECT Num (but I would expect the same result since that's the only column in the table). SELECT  Num FROM @Nums         CROSS APPLY         (             SELECT  Num * 2 as Doubled         ) as NewTable But instead I only get one column of output - the engine simply ignores my Cross Apply clause. Why?    After all, I'm told that using SELECT * is bad practice because I should name my columns explicitly. But in this case I'm getting punished for naming my columns explicitly?  I must be doing something wrong, but I don't know what it is.

Ignore trailer record in delimited file

SSIS 2008 I receive flat data files from a vendor that are pipe delimited however there is a header row and a trailer row that is not pipe delimited.  The first row is easily bypassed however SSIS rightfully complains about the last row;  “There is a partial row at the end of the file”  Short of having a separate process to strip the trailer record is there a way for SSIS to ignore this row?  Currently I am using a simple data flow with a flat file source and a OLE DB destination (database) with the usual column mapping. I can ascertain the data rows from the trailer row by the first character.  Data rows start with ‘D’ and the trailer row starts with ‘T’.     Thanks for any help! RJ  

How to ignore SQLAgent$SBSMonitoring service from being reported 'not started' as this is a featur


On MS SBS 2003 Server Performance Report the SQLAgent$SBSMonitoring service is reported as "auto-started services not running". This is a feature, just as with Microsoft .NET Framework NGEN v4.0.30319_X86 in this thread.

How do I ignore this service in the way the .NET Framework NGEN service is ignored through web.config? I suppose it's something like adding this line to the web.config:

<add key="SERVICES_TO_IGNORE" value="SysmonLog;clr_optimization_v4.0.30319_32"/>

...but with the right reference to the SQLAgent$SBSMONITORING service. The example above is for the .NET Framework NGEN service.

Kind regards,
G from NL

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend