473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Re: XML namespace and LINQ to XML

From what I've experienced, importing a namespace works. Try this:

VB.NET Imports xmlns="http://P2SWorld.com/AutoDeveloper/AutoDoc/Project"

C#.NET using xmlns="http://P2SWorld.com/AutoDeveloper/AutoDoc/Project"
Your code should work as though you didn't have a namespace. You need not create an
XNamespace object for it to work.

Cheers :)
Jun 27 '08 #1
3 2915
Hello Roshawn,

Thanks for your great suggestion. This is really the best way to import
default namespace in VB.net project. But, as far as I know, C# doesn't
support such default namespace. We cannot import namespace by Using
Statement in C#. I think this is the feature Alexander requires in C#
project.
In C#, we have to use XNamespace to import namespace. Alternative way is to
extend XElement as Alexander suggested.

If I misunderstood anything here, please don't hesitate to correct me.
Thanks in advance.
Have a great day,
Best regards,
Wen Yuan
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 27 '08 #2
Do you see any design problems with this, I wil impliment this if you think
it will work.
--
Alexander L. Wykel
AW Software Works

""Wen Yuan Wang [MSFT]"" wrote:
Hello Roshawn,

Thanks for your great suggestion. This is really the best way to import
default namespace in VB.net project. But, as far as I know, C# doesn't
support such default namespace. We cannot import namespace by Using
Statement in C#. I think this is the feature Alexander requires in C#
project.
In C#, we have to use XNamespace to import namespace. Alternative way is to
extend XElement as Alexander suggested.

If I misunderstood anything here, please don't hesitate to correct me.
Thanks in advance.
Have a great day,
Best regards,
Wen Yuan
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 27 '08 #3
Hello Alexander,
Thanks for your reply.

Do you talk about the default name solution? I think it's fine to extent
XElement class. We can add our own namespace in subclass. Thereby, subclass
could query the element by added default namespace. That should work.
Anyway, if you face any further issue when implementing this solution,
please also feel free to let us know. We are glad to assist you.

Have a great day,
Best regards,
Wen Yuan

Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: =?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?= | last post by:
I recently raninto major problems when I added the Exception namespace to the Project which has my DBML file attached to it. Once I renamed all the Exceptions instances to Syste.Exception the...
1
by: =?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?= | last post by:
Thank you Wen Yuan, This did answer my question, but it took a lot of work to implement. My original code did not use any namespace so I had to modify and test some 3000 lines of code to make...
2
by: SR | last post by:
How can I remove an empty namespace with XElement ? Using the below code I wish to apply the namespace only to the root node <urlsetbut I obtain also an empty xmlns="" on the child nodes. Thanks...
9
by: =?Utf-8?B?cmF1bGF2aQ==?= | last post by:
Hi all: after reading different places/sites about linq... I ran into these questions: 1. What framework do we need to run linq ? (does it depend on what version of visual studio we have?) how...
11
by: Michael Bray | last post by:
I'm playing around with XElement stuff, and I've come across a difficulty. The XML document that I'm reading contains an xmlns declaration on the main node... <root xmlns="http://www.me.com">...
0
by: =?Utf-8?B?SHlwZXJjb2Rlcg==?= | last post by:
I'm encountering some strange behavior after deploying a ASP.net 3.5 website to production, i'm unable to reproduce these in my dev environment. This error seems to occur very randomly but it's...
4
by: =?Utf-8?B?RXJpYyBGYWxza2Vu?= | last post by:
We’re storing our main entity in an insert only table which stores the history of past revisions, but we’re facing problems with storing this history as LINQ will only update the entity, and...
14
by: thj | last post by:
Hi, I was wondering what you guys are using and why? LINQ to SQL or NHibernate? Thanks in advance, Tommy
3
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post by:
I'm attempting to use LINQ to insert a record into a child table and I'm receiving a "Specified cast is not valid" error that has something to do w/ the keys involved. The stack trace is: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.