c# - Why won't this XPath query work on an .edmx file? -
I am trying to get the list of EntityTypes in an EDMX file, and the following query does not return any results:
XmlDocument edmxFile = new XmlDocument (); EdmxFile.Load (args [0]); XmlNamespaceManager nsMan = New XmlNamespaceManager (edmxFile.NameTable); NsMan.AddNamespace ("edmx", "http://schemas.microsoft.com/ado/2007/06/edmx"); NsMan.AddNamespace ("s", "http://schemas.microsoft.com/ado/2007/06/edm/ssdl"); NsMan.AddNamespace ("e", "http://schemas.microsoft.com/ado/2007/06/edm"); NsMan.AddNamespace ("u", "Kalash: schema-microsoft-com: windows: storage: mapping: sc"); XMLNodeList entity type = edmxFile.DocumentElement.SelectNodes ("// EntityType", nsMan); // Returns 0 nodes XmlNodeList entityTypes = edmxFile.SelectNodes ("// EntityType"); // Return 0 node too
Why does XPath work here?
It's been a while, but I think that in your call for those methods, Code> "// s: EntityType" is required.
Comments
Post a Comment