dotnet / dotnet/dotnet-api-docs
Issue with return value of XmlNamespaceManager.LookupPrefix
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
**Issue description**
The [docs](https://docs.microsoft.com/en-us/dotnet/api/system.xml.xmlnamespacemanager.lookupprefix?view=net-5.0#returns) says that the return value of XmlNamespaceManager.LookupPrefix returns `The matching prefix. If there is no mapped prefix, the method returns String.Empty. If a null value is supplied, then null is returned.`
My tests indicate that this method returns null if there is no mapped prefix.
Example:
```
XmlNamespaceManager mgr = new XmlNamespaceManager(new NameTable());
var prefix = mgr.LookupPrefix("http://www.microsoft.com");
if (prefix == null)
Console.WriteLine("Prefix is null");
else
Console.WriteLine("Prefix is not null");
```
This code outputs "Prefix is null". According to the docs the returned prefix should have been String.Empty.
**Target framework**
- [x] .NET Core 5.0
- [x] .NET Framework 4.8
dotnet --info output or About VS info
```console
```
Contributor guide
Assessment
This issue has not been assessed yet.