This is really bugging me..

I have an xml file were I want to get info by doing a xpath query with SelectSingleNode and SelectNodes.
.Net requires you to use namespacemanager, but I cant get it work. The query just gives me null.

When I take my namespace xmlns=".." from the root element away then it works.
Here is the code and xml file...could someone help me please?
c#:

try

{

XmlDocument doc = new XmlDocument();

doc.Load("sampleXML.xml");

System.Xml.XmlNamespaceManager nsmg = new System.Xml.XmlNamespaceManager(doc.NameTable);

nsmg.AddNamespace("test", http://www.test.com);

//Lasketaan alignments:ien määrä tiedostossa

int alignments;

alignments = doc.SelectNodes("//test:Alignment", nsmg).Count; //return null

MessageBox.Show(alignments.ToString());

}

catch(Exception ex)

{
MessageBox.Show(ex.ToString());
}



xml:

http://www.landxml.org/schema/LandXML-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.landxml.org/schema/LandXML-1.0 http://www.landxml.org/schema/LandXML-1.0/LandXML-1.0.xsd"  date="2005-06-07" time="12:47:44" version="1.0">
 
  
 

 www.novapoint.com">
  
 

 
 
  
   
    
    
     6898657.303415 3544669.113915
     6898952.704715 3544700.551827