Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Re: XML namespace and LINQ to XML

Question posted by: Roshawn (Guest) on June 27th, 2008 07:20 PM
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 :)
Wen Yuan Wang [MSFT]'s Avatar
Wen Yuan Wang [MSFT]
Guest
n/a Posts
June 27th, 2008
07:20 PM
#2

Re: Re: XML namespace and LINQ to XML
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:
Join Bytes!.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


=?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?='s Avatar
=?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?=
Guest
n/a Posts
June 27th, 2008
07:20 PM
#3

Re: Re: XML namespace and LINQ to XML
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:
Quote:
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:
Join Bytes!.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
>
>


Wen Yuan Wang [MSFT]'s Avatar
Wen Yuan Wang [MSFT]
Guest
n/a Posts
June 27th, 2008
07:20 PM
#4

Re: Re: XML namespace and LINQ to XML
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:
Join Bytes!.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


 
Not the answer you were looking for? Post your question . . .
189,798 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors