Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Verifying if namespace exists
Message
From
26/07/2015 09:58:31
 
 
General information
Forum:
ASP.NET
Category:
XML
Environment versions
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01622469
Message ID:
01622523
Views:
60
>Ha. Misread your requirements - thought you just wanted to check whether it was already defined. If you want to populate the NameTable with all of the namespaces used in a specific piece of XML I came across this approach:
> XmlDocument doc = new XmlDocument();
> doc.LoadXml(*whatever*);
>XmlNodeList nameSpaceList = doc.SelectNodes(@"//namespace::*[not(. = ../../namespace::*)]");
> var _xmlNSmgr = new XmlNamespaceManager(doc.NameTable);
>foreach (XmlNode nsNode in nameSpaceList)
>            {
>                _xmlNSmgr.AddNamespace(nsNode.LocalName, nsNode.Value);
>            }
Only made a quick test but it seems to work......

Ok, that is very interesting.

Thanks for sharing this.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform