# Patch created by minddog # Date: Tue Jan 14 13:25:25 MST 2003 # Repository: pnetlib # Comments: # #### End of Preamble #### #### Patch data follows #### Index: System.Xml/XmlTextReader.cs =================================================================== RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlTextReader.cs,v retrieving revision 1.22 diff -c -r1.22 XmlTextReader.cs *** System.Xml/XmlTextReader.cs 14 Jan 2003 17:32:12 -0000 1.22 --- System.Xml/XmlTextReader.cs 14 Jan 2003 20:25:28 -0000 *************** *** 53,59 **** private String localName; private String namespaceURI; private String value; ! internal XmlAttribute attr; private XmlAttributeCollection attributes; private int attributeIndex; private int depth; --- 53,59 ---- private String localName; private String namespaceURI; private String value; ! private XmlAttribute attr; private XmlAttributeCollection attributes; private int attributeIndex; private int depth; *************** *** 94,100 **** localName = String.Empty; namespaceURI = String.Empty; value = String.Empty; ! attr = null; attributes = new XmlAttributeCollection(attr); attributeIndex = -1; depth = 1; --- 94,100 ---- localName = String.Empty; namespaceURI = String.Empty; value = String.Empty; ! attr = new XmlAttributeToken(nameTable,null,null); attributes = new XmlAttributeCollection(attr); attributeIndex = -1; depth = 1; *************** *** 460,466 **** localName = String.Empty; namespaceURI = String.Empty; value = String.Empty; ! attributes = null; attributeIndex = -1; isEmpty = false; } --- 460,467 ---- localName = String.Empty; namespaceURI = String.Empty; value = String.Empty; ! attr = new XmlAttributeToken(nameTable,null,null); ! attributes = new XmlAttributeCollection(attr); attributeIndex = -1; isEmpty = false; } *************** *** 830,835 **** --- 831,837 ---- name = builder.ToString(); SetName(name); nodeType = XmlNodeType.Attribute; + attr=new XmlAttributeToken(nameTable,name,null); attributeIndex++; // reset buffer builder = new StringBuilder(); *************** *** 851,856 **** --- 853,860 ---- if((char)ch == QuoteChar) { value = builder.ToString(); + attr.Value=value; + attributes.Append(attr); nodeType = XmlNodeType.Text; // go to next char *************** *** 1614,1619 **** --- 1618,1692 ---- return xmlSpace; } } + + + // Note: this is a hack to implement XmlTextReader without + // building an XmlDocument along with it. + // Do *not* use this elsewhere as a substitute for XmlAttribute + // Also, the use is restricted to a minimum here as well + internal class XmlAttributeToken : XmlAttribute + { + private String value = null; + + public XmlAttributeToken(XmlNameTable nt,String name,String ns): + base(null,GetNameInfo(nt,name,null,null)) + { + } + + private static NameCache.NameInfo GetNameInfo(XmlNameTable nt, + String localName, + String prefix, + String ns) + { + String name; + + if(localName == null) + { + localName = String.Empty; + } + else + { + localName = nt.Add(localName); + } + if(prefix == null) + { + prefix = String.Empty; + } + else + { + prefix = nt.Add(prefix); + } + if(ns == null) + { + prefix = String.Empty; + } + else + { + ns=nt.Add(ns); + } + if(prefix.Length > 0) + { + name = nt.Add(prefix + ":" + localName); + } + else + { + name = localName; + } + return new + NameCache.NameInfo(localName, prefix, name, ns, null); + } + public override String Value + { + get + { + return this.value; + } + set + { + this.value = value; + } + } + } }; // class XmlTextReader #### End of Patch data ####