Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verifying if namespace exists
Message
De
26/07/2015 09:58:31
 
 
À
25/07/2015 04:12:09
Information générale
Forum:
ASP.NET
Catégorie:
XML
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01622469
Message ID:
01622523
Vues:
59
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform