[Mono-list] Re: some System.XML bugfixes
Sebastien Pouliot
Sebastien Pouliot <spouliot@videotron.ca>
Mon, 02 Dec 2002 19:21:55 -0500
Nope. I still got the same results :-(
<KeyInfo
xmlns="http://www.w3.org/2000/09/xmldsig#"><KeyName>Mono::</KeyName></KeyInf
o>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"><KeyName
xmlns="http://www.w3.org/2000/09/xmldsig#">Mono::</KeyName></KeyInfo>
here's the code being called...
int KeyInfoTest.cs
KeyInfo info;
public void TestKeyInfoName ()
{
KeyInfoName name = new KeyInfoName ();
name.Value = "Mono::";
info.AddClause (name);
//******** this is the assertion that fails ******** !
AssertEquals ("name", "<KeyInfo
xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><KeyName>Mono::</KeyName></KeyI
nfo>", (info.GetXml ().OuterXml));
AssertEquals ("name count", 1, info.Count);
}
in KeyInfo.cs
public XmlElement GetXml ()
{
StringBuilder sb = new StringBuilder ();
sb.Append ("<KeyInfo xmlns=\"");
sb.Append (xmldsig);
sb.Append ("\" />");
XmlDocument doc = new XmlDocument ();
doc.LoadXml (sb.ToString ());
// we add References afterward so we don't end up with extraneous
// xmlns="..." in each reference elements.
foreach (KeyInfoClause kic in Info) {
XmlNode xn = kic.GetXml ();
XmlNode newNode = doc.ImportNode (xn, true);
doc.DocumentElement.AppendChild (newNode);
}
return doc.DocumentElement;
}
in KeyInfoName.cs
public override XmlElement GetXml ()
{
StringBuilder sb = new StringBuilder ();
sb.Append ("<KeyName xmlns=\"http://www.w3.org/2000/09/xmldsig#\">");
sb.Append (Name);
sb.Append ("</KeyName>");
XmlDocument doc = new XmlDocument ();
doc.LoadXml (sb.ToString ());
return doc.DocumentElement;
}
Would creating the XmlDocument with CreateElement (and so on) produce the
same ?
I was thinking about removing all StringBuilder from the code anyway...
Thanks
Sebastien Pouliot
Security Architect, Motus Technologies, http://www.motus.com/
work: spouliot@motus.com
home: spouliot@videotron.ca
----- Original Message -----
From: "ginga(A.E.)" <ginga@kit.hi-ho.ne.jp>
To: "mono-list" <mono-list@ximian.com>
Sent: Monday, December 02, 2002 1:16 PM
Subject: [Mono-list] Re: some System.XML bugfixes
> Hello.
>
> > This is the Xml generated by Mono:
> > <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"><KeyName
> > xmlns="http://www.w3.org/2000/09/xmldsig#">Mono::</KeyName></KeyInfo>
> >
> > Both Xml fragment are equivalent - but make it hard to do direct string
> > compare in the unit tests.
> > Do we consider this a bug ?
>
> Well, I think I've just fixed. Please check it.
>
> # I've reverted CreateNavigator(XmlNode)
>
> Thanks,
>
> -- A.Enomoto
>
>
> _______________________________________________
> Mono-list maillist - Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>