[Mono-list] XmlNamespaceManager.LookupPrefix
ginga(A.E.)
ginga@kit.hi-ho.ne.jp
Fri, 17 Jan 2003 02:40:16 +0900
Hello,
I noticed that mono's XmlNamespaceManager.LookupPrefix method is
implemented as MS describes in their documentation:
<blockquote>
Return Value
The matching prefix. If there is no mapped prefix, the method
returns String.Empty. If a null value is supplied then a null
reference (Nothing in Visual Basic) is returned.
</blockquote>
But I simply tried below with MS.NET, then LookupPrefix returned null:
--------
using System;
using System.Xml;
public class NamespaceManagerTest
{
public static void Main (String[] args) {
XmlNamespaceManager nsmgr = new XmlNamespaceManager (new NameTable ());
nsmgr.NameTable.Add ("urn:hoge");
nsmgr.NameTable.Add ("urn:fuga");
nsmgr.AddNamespace (string.Empty, "urn:hoge");
string ns = nsmgr.LookupPrefix ("urn:fuga");
Console.WriteLine ((ns == null).ToString ()); // TRUE!!
ns = nsmgr.LookupPrefix ("urn:hoge");
Console.WriteLine ((ns == String.Empty).ToString ()); // TRUE
}
}
--------
I think that LookupPrefix *should* return null (rather than
String.Empty) as MS implementation does.
Otherwise, we cannot identify "default namespace" from no match.
Does anyone think different or have any hints and/or opinion?
Thanks,
-- Atsushi Eno