[Mono-list] XmlNamespaceManager.LookupPrefix

Marcey, Joel I joel.i.marcey@intel.com
Wed, 22 Jan 2003 09:07:06 -0800


Greetings,

Just to let you know, the edition 2 specification has corrected this
issue to state that:

"Return Value

A System.String containing the namespace URI for prefix, or null if
there is no mapped namespace."

I actually brought this issue up to the committee during a meeting
because I was implementing NamespaceManager for Intel's OCL.

If you go to one of the ECMA TC39 TG3 committee member mirror sites
(e.g. http://www.intel.com/ids/ecma), you can get the edition 2
specifications...posted there about 1 1/2 months ago. There are a lot of
fixes/updates to the edition 1 specification in these updated specs and
might help resolve some of these inconsistency issues you have been
seeing.

Thanks,
- Joel Marcey

* The views expressed here do not necessarily represent those of Intel
Corporation, its subsidiaries and/or its employees.*

-----Original Message-----
From: ginga(A.E.) [mailto:ginga@kit.hi-ho.ne.jp]=20
Sent: Thursday, January 16, 2003 9:40 AM
To: mono-list
Subject: [Mono-list] XmlNamespaceManager.LookupPrefix

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 =3D new XmlNamespaceManager (new NameTable
());
    nsmgr.NameTable.Add ("urn:hoge");
    nsmgr.NameTable.Add ("urn:fuga");
    nsmgr.AddNamespace (string.Empty, "urn:hoge");
    string ns =3D nsmgr.LookupPrefix ("urn:fuga");
    Console.WriteLine ((ns =3D=3D null).ToString ());          // TRUE!!
    ns =3D nsmgr.LookupPrefix ("urn:hoge");
    Console.WriteLine ((ns =3D=3D 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


_______________________________________________
Mono-list maillist  -  Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list