[Mono-devel-list] System.Xml.XmlAttribute.Specified should not be default True
Boris Kirzner
borisk at mainsoft.com
Tue Jan 13 01:52:26 EST 2004
Hello
What exactly event bugs are you talking about?
Do you have a test case for them ?
Thank you
Boris
Atsushi Eno wrote:
> Hello,
>
> Thanks. I found this patch arose some event bugs and it looks not so
> easy to fix soon, but this patch should be applied.
>
> Atsushi Eno
>
> Boris Kirzner wrote:
>
>> Hello
>>
>> The Specified attribute for an System.Xml.XmlAttribute node should be
>> set to False if the attribute was not explicitly given a value.
>>
>> Steps to reproduce the problem :
>> 1. Create DTD file defining some node having default attribute value.
>> 2. Create XML file referencing the DTD, with node inside that
>> attribute value having default in DTD is not explicitly specified.
>> 3. Load XML document into XmlDocument
>> 4. Inspect Specified property of the attribute.
>>
>> Actual result :
>> True
>>
>> Expected result :
>> False
>>
>> Enclosed is a small test case and a patch.
>>
>> Thank you in advance,
>>
>> Boris Kirzner
>>
>>
>> ------------------------------------------------------------------------
>>
>> <?xml version="1.0"?>
>> <!DOCTYPE staff SYSTEM "staff.dtd"[]>
>> <staff>
>> <employee>
>> <address>1230 North Ave. Dallas, Texas 98551</address>
>> </employee>
>> </staff>
>>
>>
>> ------------------------------------------------------------------------
>>
>> using System;
>> using System.Xml;
>>
>> public class Test
>> {
>> static void Main(string[] args)
>> {
>> XmlDocument doc = new XmlDocument();
>> doc.Load("staff.xml");
>> XmlNodeList nodeList =
>> doc.DocumentElement.GetElementsByTagName("employee");
>> System.Xml.XmlElement testNode =
>> (System.Xml.XmlElement)nodeList.Item(0).ChildNodes.Item(0);
>> XmlAttribute streetAttr =
>> (System.Xml.XmlAttribute)testNode.Attributes.GetNamedItem("street");
>> Console.WriteLine(streetAttr.Specified.ToString());
>> }
>> }
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> --- old\XmlElement.cs 2004-01-12 18:38:28.000000000 +0200
>> +++ new\XmlElement.cs 2004-01-12 18:14:27.992210100 +0200
>> @@ -66,7 +66,10 @@
>> for (int i = 0; i < attlist.Definitions.Count;
>> i++) {
>> DTDAttributeDefinition def = attlist [i];
>> if (def.DefaultValue != null)
>> + {
>> SetAttribute (def.Name, def.DefaultValue);
>> + attributes[def.Name].SetDefault();
>> + }
>> }
>> }
>> }
>
>
>
More information about the Mono-devel-list
mailing list