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 sure this would work. I think it would be easier if
there was some was you could subclass the XElement, provide your own
namespace and then global search and replace would be much easier.
Then you could do this:
Where you had this:
guiNodes = xdoc.Element(Gl obalArrtib.tabN ameSpace +
"AutoDoc").Elem ent(GlobalArrti b.tabNameSpace +
"TabPage").Elem ent(GlobalArrti b.tabNameSpace + "DetailView ");
replace with this:
//Global definition of your Element types...
ElementAutoDoc ad = ElementAutoDoc( );
ad.NameSpace = GlobalArrtib.au toDocNameSpace;
ElementAutoDocT abPage adtp= ElementAutoDocT abPage();
adtp.NameSpace = GlobalArrtib.ta bPageNameSpace;
ElementAutoDocD etail add = ElementAutoDocD etail();
add.NameSpace = GlobalArrtib.de tailNameSpace;
the you can have:
//code implimentation
guiNodes =
xdoc.ElementAut oDoc("AutoDoc") .ElementAutoDoc TabPage("TabPag e").ElementAuto DocDetail ("DetailView ");
Which is much cleaner.
The current version cause a lot of string concatenation.
Is there any plan on implementing LINQ to XML the way it's done in VB with
C#? That is much cleaner.
Alexander L. Wykel
--
Alexander L. Wykel
AW Software Works
""Wen Yuan Wang [MSFT]"" wrote:
Hello Alexander,
What you need is to define a namespace for LINQ to XML.
Please try the following method.
XNamespace ns =
"http://P2SWorld.com/AutoDeveloper/AutoDoc/Project";
XDocument projectFile = XDocument.Load( "XMLFile.xm l");
XElement tabs =
projectFile.Ele ment(ns+"Projec t").Element(ns+ "Tabs");
Hope this helps. Please let me know if this works fine on your side. 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****@microsof t.com.
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.