Hi All,
I have the following code:
<snip>
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml( @"<?xml version=""1.0"" encoding=""UTF-8""?>
<myConfig:myCon fig xmlns:myConfig= ""http://mycomp/myConfig.xsd"">
<myConfig:title >My Title</myConfig:title>
</myConfig:myConf ig>");
XmlNamespaceMan ager namespaceManage r = new
XmlNamespaceMan ager(xmlDoc.Nam eTable);
namespaceManage r.AddNamespace( "myConfig", "http://mycomp/myConfig.xsd");
string prefix = namespaceManage r.LookupPrefix( "http://mycomp/myConfig.xsd");
Console.WriteLi ne("Prefix is: " + prefix);
</snip>
What I am trying to do is to lookup the prefix for the namespace that I
want. But ..this always returns null? What do I do wrong here?
Thanks
I have the following code:
<snip>
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml( @"<?xml version=""1.0"" encoding=""UTF-8""?>
<myConfig:myCon fig xmlns:myConfig= ""http://mycomp/myConfig.xsd"">
<myConfig:title >My Title</myConfig:title>
</myConfig:myConf ig>");
XmlNamespaceMan ager namespaceManage r = new
XmlNamespaceMan ager(xmlDoc.Nam eTable);
namespaceManage r.AddNamespace( "myConfig", "http://mycomp/myConfig.xsd");
string prefix = namespaceManage r.LookupPrefix( "http://mycomp/myConfig.xsd");
Console.WriteLi ne("Prefix is: " + prefix);
</snip>
What I am trying to do is to lookup the prefix for the namespace that I
want. But ..this always returns null? What do I do wrong here?
Thanks
Comment