dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/System.Xml NameCache.cs,1.1,1.2 NodeL


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System.Xml NameCache.cs,1.1,1.2 NodeList.cs,1.4,1.5 XmlAttribute.cs,1.4,1.5 XmlCharacterData.cs,1.1,1.2 XmlDeclaration.cs,1.2,1.3 XmlDocument.cs,1.5,1.6 XmlDocumentFragment.cs,1.2,1.3 XmlElement.cs,1.4,1.5 XmlFragmentTextWriter.cs,1.1,1.2 XmlNode.cs,1.10,1.11 XmlProcessingInstruction.cs,1.1,1.2 XmlText.cs,1.1,1.2 XmlTextReader.cs,1.9,1.10 XmlTextWriter.cs,1.3,1.4
Date: Thu, 05 Dec 2002 23:58:35 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/System.Xml
In directory subversions:/tmp/cvs-serv30516/System.Xml

Modified Files:
        NameCache.cs NodeList.cs XmlAttribute.cs XmlCharacterData.cs 
        XmlDeclaration.cs XmlDocument.cs XmlDocumentFragment.cs 
        XmlElement.cs XmlFragmentTextWriter.cs XmlNode.cs 
        XmlProcessingInstruction.cs XmlText.cs XmlTextReader.cs 
        XmlTextWriter.cs 
Log Message:


Test cases and bug fixes for System.Xml.


Index: NameCache.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/NameCache.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** NameCache.cs        3 Dec 2002 07:28:06 -0000       1.1
--- NameCache.cs        6 Dec 2002 04:58:32 -0000       1.2
***************
*** 63,67 ****
                                if(ns != null)
                                {
!                                       ns = nameTable.Add(prefix);
                                }
                                else
--- 63,67 ----
                                if(ns != null)
                                {
!                                       ns = nameTable.Add(ns);
                                }
                                else

Index: NodeList.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/NodeList.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** NodeList.cs 5 Dec 2002 22:19:53 -0000       1.4
--- NodeList.cs 6 Dec 2002 04:58:32 -0000       1.5
***************
*** 199,202 ****
--- 199,204 ----
                                        first = nodeList.nextSibling;
                                }
+                               nodeList.nextSibling = null;
+                               nodeList.prevSibling = null;
                                --count;
                                ++generation;

Index: XmlAttribute.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlAttribute.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** XmlAttribute.cs     5 Dec 2002 22:19:53 -0000       1.4
--- XmlAttribute.cs     6 Dec 2002 04:58:32 -0000       1.5
***************
*** 34,38 ****
        // Internal state.
        private NameCache.NameInfo name;
-       internal char quoteChar;
  
        // Constructor.
--- 34,37 ----
***************
*** 41,45 ****
                        {
                                this.name = name;
-                               this.quoteChar = '"';
                        }
  
--- 40,43 ----
***************
*** 54,58 ****
  
        // Get the inner text version of this node.
-       [TODO]
        public override String InnerText
                        {
--- 52,55 ----
***************
*** 63,67 ****
                                set
                                {
!                                       // TODO
                                }
                        }
--- 60,64 ----
                                set
                                {
!                                       base.InnerText = value;
                                }
                        }
***************
*** 122,134 ****
                                get
                                {
!                                       XmlElement owner = OwnerElement;
!                                       if(owner != null)
!                                       {
!                                               return owner.OwnerDocument;
!                                       }
!                                       else
!                                       {
!                                               return null;
!                                       }
                                }
                        }
--- 119,123 ----
                                get
                                {
!                                       return base.OwnerDocument;
                                }
                        }
***************
*** 139,143 ****
                                get
                                {
!                                       return (XmlElement)parent;
                                }
                        }
--- 128,139 ----
                                get
                                {
!                                       if(parent == null || 
parent.IsPlaceholder)
!                                       {
!                                               return null;
!                                       }
!                                       else
!                                       {
!                                               return (XmlElement)parent;
!                                       }
                                }
                        }
***************
*** 166,170 ****
                                get
                                {
-                                       // TODO
                                        return true;
                                }
--- 162,165 ----
***************
*** 176,184 ****
                                get
                                {
!                                       return null;
                                }
                                set
                                {
!                                       // TODO
                                }
                        }
--- 171,179 ----
                                get
                                {
!                                       return InnerText;
                                }
                                set
                                {
!                                       InnerText = value;
                                }
                        }
***************
*** 187,192 ****
        public override XmlNode CloneNode(bool deep)
                        {
!                               // TODO
!                               return null;
                        }
  
--- 182,189 ----
        public override XmlNode CloneNode(bool deep)
                        {
!                               XmlAttribute attr = 
OwnerDocument.CreateAttribute
!                                       (Prefix, LocalName, NamespaceURI);
!                               attr.CloneChildrenFrom(this, true);
!                               return attr;
                        }
  
***************
*** 194,198 ****
        public override void WriteContentTo(XmlWriter w)
                        {
!                               // TODO
                        }
  
--- 191,195 ----
        public override void WriteContentTo(XmlWriter w)
                        {
!                               WriteChildrenTo(w);
                        }
  
***************
*** 200,204 ****
        public override void WriteTo(XmlWriter w)
                        {
!                               // TODO
                        }
  
--- 197,203 ----
        public override void WriteTo(XmlWriter w)
                        {
!                               w.WriteStartAttribute(Prefix, LocalName, 
NamespaceURI);
!                               WriteContentTo(w);
!                               w.WriteEndAttribute();
                        }
  

Index: XmlCharacterData.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlCharacterData.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** XmlCharacterData.cs 4 Dec 2002 04:46:35 -0000       1.1
--- XmlCharacterData.cs 6 Dec 2002 04:58:32 -0000       1.2
***************
*** 195,198 ****
--- 195,220 ----
        public virtual void ReplaceData(int offset, int count, String strData)
                        {
+                               // Clamp the range to the actual data bounds.
+                               int length = Length;
+                               if(offset < 0)
+                               {
+                                       count += offset;
+                                       offset = 0;
+                               }
+                               else if(offset >= length)
+                               {
+                                       offset = length;
+                                       count = 0;
+                               }
+                               if((length - offset) < count)
+                               {
+                                       count = length - offset;
+                               }
+                               if(count < 0)
+                               {
+                                       count = 0;
+                               }
+ 
+                               // Replace the range with the supplied string.
                                XmlNodeChangedEventArgs args;
                                args = EmitBefore(XmlNodeChangedAction.Change);

Index: XmlDeclaration.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlDeclaration.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** XmlDeclaration.cs   5 Dec 2002 22:19:53 -0000       1.2
--- XmlDeclaration.cs   6 Dec 2002 04:58:32 -0000       1.3
***************
*** 76,79 ****
--- 76,80 ----
  
        // Get or set the inner text.
+       [TODO]
        public override String InnerText
                        {
***************
*** 119,122 ****
--- 120,132 ----
                                {
                                        return "xml";
+                               }
+                       }
+ 
+       // Get the type that is associated with this node.
+       public override XmlNodeType NodeType
+                       {
+                               get
+                               {
+                                       return XmlNodeType.XmlDeclaration;
                                }
                        }

Index: XmlDocument.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlDocument.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** XmlDocument.cs      5 Dec 2002 22:19:53 -0000       1.5
--- XmlDocument.cs      6 Dec 2002 04:58:32 -0000       1.6
***************
*** 133,136 ****
--- 133,137 ----
  
        // Get the markup that represents the children of this node.
+       [TODO]
        public override String InnerXml
                        {
***************
*** 505,509 ****
                                        case XmlNodeType.EntityReference:
                                        {
-                                               // TODO
                                                return 
CreateEntityReference(name);
                                        }
--- 506,509 ----
***************
*** 512,516 ****
                                        case XmlNodeType.ProcessingInstruction:
                                        {
-                                               // TODO
                                                return 
CreateProcessingInstruction(name, String.Empty);
                                        }
--- 512,515 ----
***************
*** 739,742 ****
--- 738,743 ----
        internal override bool CanInsertAfter(XmlNodeType type, XmlNode refNode)
                        {
+                               XmlNode temp;
+ 
                                // Filter out types that are definitely not 
allowed.
                                if(!CanInsert(type))
***************
*** 757,767 ****
                                        {
                                                // Must not have an element 
before this position.
                                                while(refNode != null)
                                                {
!                                                       if(refNode.NodeType == 
XmlNodeType.Element)
                                                        {
                                                                return false;
                                                        }
!                                                       refNode = 
NodeList.GetPreviousSibling(refNode);
                                                }
                                        }
--- 758,780 ----
                                        {
                                                // Must not have an element 
before this position.
+                                               temp = refNode;
+                                               while(temp != null)
+                                               {
+                                                       if(temp.NodeType == 
XmlNodeType.Element)
+                                                       {
+                                                               return false;
+                                                       }
+                                                       temp = 
NodeList.GetPreviousSibling(temp);
+                                               }
+ 
+                                               // Must not have an 
XmlDeclaration after this position.
+                                               refNode = 
NodeList.GetNextSibling(refNode);
                                                while(refNode != null)
                                                {
!                                                       if(refNode.NodeType == 
XmlNodeType.XmlDeclaration)
                                                        {
                                                                return false;
                                                        }
!                                                       refNode = 
NodeList.GetNextSibling(refNode);
                                                }
                                        }
***************
*** 770,778 ****
                                        case XmlNodeType.Element:
                                        {
!                                               // Must not have a document 
type after this position.
                                                refNode = 
NodeList.GetNextSibling(refNode);
                                                while(refNode != null)
                                                {
!                                                       if(refNode.NodeType == 
XmlNodeType.DocumentType)
                                                        {
                                                                return false;
--- 783,793 ----
                                        case XmlNodeType.Element:
                                        {
!                                               // Must not have a document 
type or XmlDeclaration
!                                               // after this position.
                                                refNode = 
NodeList.GetNextSibling(refNode);
                                                while(refNode != null)
                                                {
!                                                       if(refNode.NodeType == 
XmlNodeType.DocumentType ||
!                                                          refNode.NodeType == 
XmlNodeType.XmlDeclaration)
                                                        {
                                                                return false;
***************
*** 799,802 ****
--- 814,819 ----
        internal override bool CanInsertBefore(XmlNodeType type, XmlNode 
refNode)
                        {
+                               XmlNode temp;
+ 
                                // Filter out types that are definitely not 
allowed.
                                if(!CanInsert(type))
***************
*** 817,828 ****
                                        {
                                                // Must not have an element 
before this position.
!                                               refNode = 
NodeList.GetPreviousSibling(refNode);
                                                while(refNode != null)
                                                {
!                                                       if(refNode.NodeType == 
XmlNodeType.Element)
                                                        {
                                                                return false;
                                                        }
!                                                       refNode = 
NodeList.GetPreviousSibling(refNode);
                                                }
                                        }
--- 834,855 ----
                                        {
                                                // Must not have an element 
before this position.
!                                               temp = 
NodeList.GetPreviousSibling(refNode);
!                                               while(temp != null)
!                                               {
!                                                       if(temp.NodeType == 
XmlNodeType.Element)
!                                                       {
!                                                               return false;
!                                                       }
!                                                       temp = 
NodeList.GetPreviousSibling(temp);
!                                               }
! 
!                                               // Must not have an 
XmlDeclaration after this position.
                                                while(refNode != null)
                                                {
!                                                       if(refNode.NodeType == 
XmlNodeType.XmlDeclaration)
                                                        {
                                                                return false;
                                                        }
!                                                       refNode = 
NodeList.GetNextSibling(refNode);
                                                }
                                        }
***************
*** 831,838 ****
                                        case XmlNodeType.Element:
                                        {
!                                               // Must not have a document 
type after this position.
                                                while(refNode != null)
                                                {
!                                                       if(refNode.NodeType == 
XmlNodeType.DocumentType)
                                                        {
                                                                return false;
--- 858,867 ----
                                        case XmlNodeType.Element:
                                        {
!                                               // Must not have a document 
type or XmlDeclaration
!                                               // after this position.
                                                while(refNode != null)
                                                {
!                                                       if(refNode.NodeType == 
XmlNodeType.DocumentType ||
!                                                          refNode.NodeType == 
XmlNodeType.XmlDeclaration)
                                                        {
                                                                return false;
***************
*** 853,856 ****
--- 882,894 ----
                                // If we get here, then the node is allowed.
                                return true;
+                       }
+ 
+       // Get the placeholder document fragment associated with a document.
+       internal XmlDocumentFragment Placeholder
+                       {
+                               get
+                               {
+                                       return placeholder;
+                               }
                        }
  

Index: XmlDocumentFragment.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlDocumentFragment.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** XmlDocumentFragment.cs      5 Dec 2002 22:19:53 -0000       1.2
--- XmlDocumentFragment.cs      6 Dec 2002 04:58:32 -0000       1.3
***************
*** 42,45 ****
--- 42,46 ----
  
        // Get the markup that represents the children of this node.
+       [TODO]
        public override String InnerXml
                        {

Index: XmlElement.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlElement.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** XmlElement.cs       5 Dec 2002 22:19:53 -0000       1.4
--- XmlElement.cs       6 Dec 2002 04:58:32 -0000       1.5
***************
*** 64,67 ****
--- 64,68 ----
  
        // Get the inner text version of this node.
+       [TODO]
        public override String InnerText
                        {
***************
*** 78,81 ****
--- 79,83 ----
  
        // Get the markup that represents the children of this node.
+       [TODO]
        public override String InnerXml
                        {
***************
*** 154,166 ****
                                get
                                {
!                                       XmlNode parent = ParentNode;
!                                       if(parent != null)
!                                       {
!                                               return parent.OwnerDocument;
!                                       }
!                                       else
!                                       {
!                                               return null;
!                                       }
                                }
                        }
--- 156,160 ----
                                get
                                {
!                                       return base.OwnerDocument;
                                }
                        }
***************
*** 185,188 ****
--- 179,183 ----
  
        // Clone this node in either shallow or deep mode.
+       [TODO]
        public override XmlNode CloneNode(bool deep)
                        {
***************
*** 192,195 ****
--- 187,191 ----
  
        // Get the value of an attribute with a specific name.
+       [TODO]
        public virtual String GetAttribute(String name)
                        {
***************
*** 199,202 ****
--- 195,199 ----
  
        // Get the value of an attribute with a specific name and namespace.
+       [TODO]
        public virtual String GetAttribute(String localName, String 
namespaceURI)
                        {
***************
*** 206,209 ****
--- 203,207 ----
  
        // Get the node of an attribute with a specific name.
+       [TODO]
        public virtual XmlAttribute GetAttributeNode(String name)
                        {
***************
*** 213,216 ****
--- 211,215 ----
  
        // Get the node of an attribute with a specific name and namespace.
+       [TODO]
        public virtual XmlAttribute GetAttributeNode
                                (String localName, String namespaceURI)
***************
*** 221,224 ****
--- 220,224 ----
  
        // Get a list of all descendents that match a particular name.
+       [TODO]
        public virtual XmlNodeList GetElementsByTagName(String name)
                        {
***************
*** 228,231 ****
--- 228,232 ----
  
        // Get a list of all descendents that match a particular name and 
namespace.
+       [TODO]
        public virtual XmlNodeList GetElementsByTagName
                                (String localName, String namespaceURI)
***************
*** 236,239 ****
--- 237,241 ----
  
        // Determine if this element has a particular attribute.
+       [TODO]
        public virtual bool HasAttribute(String name)
                        {
***************
*** 243,246 ****
--- 245,249 ----
  
        // Determine if this element has a particular attribute.
+       [TODO]
        public virtual bool HasAttribute(String localName, String namespaceURI)
                        {
***************
*** 257,260 ****
--- 260,264 ----
  
        // Remove all of the attributes from this node.
+       [TODO]
        public virtual void RemoveAllAttributes()
                        {
***************
*** 263,266 ****
--- 267,271 ----
  
        // Remove a specified attribute by name.
+       [TODO]
        public virtual void RemoveAttribute(String name)
                        {
***************
*** 269,272 ****
--- 274,278 ----
  
        // Remove a specified attribute by name and namespace.
+       [TODO]
        public virtual void RemoveAttribute(String localName, String 
namespaceURI)
                        {
***************
*** 275,278 ****
--- 281,285 ----
  
        // Remove a specified attribute by index.
+       [TODO]
        public virtual XmlNode RemoveAttributeAt(int i)
                        {
***************
*** 282,285 ****
--- 289,293 ----
  
        // Remove a particular attribute node and return the node.
+       [TODO]
        public virtual XmlAttribute RemoveAttributeNode(XmlAttribute oldAttr)
                        {
***************
*** 289,292 ****
--- 297,301 ----
  
        // Remove a particular attribute by name and return the node.
+       [TODO]
        public virtual XmlAttribute RemoveAttributeNode
                                (String localName, String namespaceURI)
***************
*** 297,300 ****
--- 306,310 ----
  
        // Set an attribute to a specific value.
+       [TODO]
        public virtual void SetAttribute(String name, String value)
                        {
***************
*** 303,306 ****
--- 313,317 ----
  
        // Set an attribute to a specific value.
+       [TODO]
        public virtual void SetAttribute(String localName, String namespaceURI,
                                                                         String 
value)
***************
*** 310,313 ****
--- 321,325 ----
  
        // Set an attribute by node.
+       [TODO]
        public virtual XmlAttribute SetAttributeNode(XmlAttribute newAttr)
                        {
***************
*** 317,320 ****
--- 329,333 ----
  
        // Create a new attribute node and return it.
+       [TODO]
        public virtual XmlAttribute SetAttributeNode
                                (String localName, String namespaceURI)
***************
*** 325,328 ****
--- 338,342 ----
  
        // Writes the contents of this node to a specified XmlWriter.
+       [TODO]
        public override void WriteContentTo(XmlWriter w)
                        {
***************
*** 331,334 ****
--- 345,349 ----
  
        // Write this node and all of its contents to a specified XmlWriter.
+       [TODO]
        public override void WriteTo(XmlWriter w)
                        {

Index: XmlFragmentTextWriter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlFragmentTextWriter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** XmlFragmentTextWriter.cs    5 Dec 2002 22:19:53 -0000       1.1
--- XmlFragmentTextWriter.cs    6 Dec 2002 04:58:32 -0000       1.2
***************
*** 40,44 ****
                        : base(writer = new StringWriter())
                        {
!                               // Nothing to do here.
                        }
  
--- 40,46 ----
                        : base(writer = new StringWriter())
                        {
!                               // Make the writer automatically shift to the 
content
!                               // area of the document if it is in the start 
state.
!                               autoShiftToContent = true;
                        }
  

Index: XmlNode.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlNode.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** XmlNode.cs  5 Dec 2002 22:19:53 -0000       1.10
--- XmlNode.cs  6 Dec 2002 04:58:32 -0000       1.11
***************
*** 134,138 ****
                                                current.CollectInner(builder);
                                        }
!                                       current = NodeList.GetNextSibling(this);
                                }
                        }
--- 134,138 ----
                                                current.CollectInner(builder);
                                        }
!                                       current = 
NodeList.GetNextSibling(current);
                                }
                        }
***************
*** 472,475 ****
--- 472,476 ----
  
                                // Perform the insert.
+                               newChild.parent = this;
                                NodeList.GetList(this).InsertAfter(newChild, 
LastChild);
  
***************
*** 630,645 ****
  
        // Insert a new child under this node just after a reference child.
-       [TODO]
        public virtual XmlNode InsertAfter(XmlNode newChild, XmlNode refChild)
                        {
!                               // TODO
                                return newChild;
                        }
  
        // Insert a new child under this node just before a reference child.
-       [TODO]
        public virtual XmlNode InsertBefore(XmlNode newChild, XmlNode refChild)
                        {
!                               // TODO
                                return newChild;
                        }
--- 631,809 ----
  
        // Insert a new child under this node just after a reference child.
        public virtual XmlNode InsertAfter(XmlNode newChild, XmlNode refChild)
                        {
!                               XmlDocument doc;
!                               XmlNode parentNode;
! 
!                               // Validate the parameters.
!                               if(refChild == null)
!                               {
!                                       return PrependChild(newChild);
!                               }
!                               if(IsAncestorOf(newChild, this))
!                               {
!                                       throw new 
InvalidOperationException(S._("Xml_IsAncestor"));
!                               }
!                               if(refChild.ParentNode != this)
!                               {
!                                       throw new ArgumentException
!                                               (S._("Xml_RefNotChild"), 
"refChild");
!                               }
!                               if(!CanInsertAfter(newChild.NodeType, refChild))
!                               {
!                                       throw new InvalidOperationException
!                                               (S._("Xml_CannotInsert"));
!                               }
!                               if(this is XmlDocument)
!                               {
!                                       doc = (XmlDocument)this;
!                               }
!                               else
!                               {
!                                       doc = OwnerDocument;
!                               }
!                               if(newChild.OwnerDocument != doc)
!                               {
!                                       throw new ArgumentException
!                                               (S._("Xml_NotSameDocument"), 
"newChild");
!                               }
!                               if(IsReadOnly)
!                               {
!                                       throw new 
ArgumentException(S._("Xml_ReadOnly"));
!                               }
! 
!                               // If the two nodes are identical, then bail 
out.
!                               if(newChild == refChild)
!                               {
!                                       return newChild;
!                               }
! 
!                               // Remove the child from underneath its current 
parent.
!                               parentNode = newChild.ParentNode;
!                               if(parentNode != null)
!                               {
!                                       parentNode.RemoveChild(newChild);
!                               }
! 
!                               // If the node is a document fragment, then add 
its
!                               // children instead of the node itself.
!                               if(newChild.NodeType == 
XmlNodeType.DocumentFragment)
!                               {
!                                       XmlNode firstChild = 
NodeList.GetFirstChild(newChild);
!                                       XmlNode current, next;
!                                       current = firstChild;
!                                       while(current != null)
!                                       {
!                                               next = 
NodeList.GetNextSibling(current);
!                                               newChild.RemoveChild(current);
!                                               refChild = InsertAfter(current, 
refChild);
!                                               current = next;
!                                       }
!                                       return firstChild;
!                               }
! 
!                               // Notify the document that we are about to do 
an insert.
!                               XmlNodeChangedEventArgs args;
!                               args = EmitBefore(XmlNodeChangedAction.Insert,
!                                                                 parentNode, 
this);
! 
!                               // Perform the insert.
!                               newChild.parent = this;
!                               NodeList.GetList(this).InsertAfter(newChild, 
refChild);
! 
!                               // Notify the document after the insert.
!                               EmitAfter(args);
! 
!                               // The child has been inserted into its new 
position.
                                return newChild;
                        }
  
        // Insert a new child under this node just before a reference child.
        public virtual XmlNode InsertBefore(XmlNode newChild, XmlNode refChild)
                        {
!                               XmlDocument doc;
!                               XmlNode parentNode;
! 
!                               // Validate the parameters.
!                               if(refChild == null)
!                               {
!                                       return AppendChild(newChild);
!                               }
!                               if(IsAncestorOf(newChild, this))
!                               {
!                                       throw new 
InvalidOperationException(S._("Xml_IsAncestor"));
!                               }
!                               if(refChild.ParentNode != this)
!                               {
!                                       throw new ArgumentException
!                                               (S._("Xml_RefNotChild"), 
"refChild");
!                               }
!                               if(!CanInsertBefore(newChild.NodeType, 
refChild))
!                               {
!                                       throw new InvalidOperationException
!                                               (S._("Xml_CannotInsert"));
!                               }
!                               if(this is XmlDocument)
!                               {
!                                       doc = (XmlDocument)this;
!                               }
!                               else
!                               {
!                                       doc = OwnerDocument;
!                               }
!                               if(newChild.OwnerDocument != doc)
!                               {
!                                       throw new ArgumentException
!                                               (S._("Xml_NotSameDocument"), 
"newChild");
!                               }
!                               if(IsReadOnly)
!                               {
!                                       throw new 
ArgumentException(S._("Xml_ReadOnly"));
!                               }
! 
!                               // If the two nodes are identical, then bail 
out.
!                               if(newChild == refChild)
!                               {
!                                       return newChild;
!                               }
! 
!                               // Remove the child from underneath its current 
parent.
!                               parentNode = newChild.ParentNode;
!                               if(parentNode != null)
!                               {
!                                       parentNode.RemoveChild(newChild);
!                               }
! 
!                               // If the node is a document fragment, then add 
its
!                               // children instead of the node itself.
!                               if(newChild.NodeType == 
XmlNodeType.DocumentFragment)
!                               {
!                                       XmlNode firstChild = 
NodeList.GetFirstChild(newChild);
!                                       XmlNode current, next;
!                                       current = firstChild;
!                                       while(current != null)
!                                       {
!                                               next = 
NodeList.GetNextSibling(current);
!                                               newChild.RemoveChild(current);
!                                               refChild = 
InsertBefore(current, refChild);
!                                               current = next;
!                                       }
!                                       return firstChild;
!                               }
! 
!                               // Notify the document that we are about to do 
an insert.
!                               XmlNodeChangedEventArgs args;
!                               args = EmitBefore(XmlNodeChangedAction.Insert,
!                                                                 parentNode, 
this);
! 
!                               // Perform the insert.
!                               newChild.parent = this;
!                               refChild = 
NodeList.GetPreviousSibling(refChild);
!                               NodeList.GetList(this).InsertAfter(newChild, 
refChild);
! 
!                               // Notify the document after the insert.
!                               EmitAfter(args);
! 
!                               // The child has been inserted into its new 
position.
                                return newChild;
                        }
***************
*** 716,719 ****
--- 880,884 ----
  
                                // Perform the insert.
+                               newChild.parent = this;
                                NodeList.GetList(this).InsertAfter(newChild, 
null);
  
***************
*** 741,744 ****
--- 906,911 ----
        public virtual XmlNode RemoveChild(XmlNode oldChild)
                        {
+                               XmlDocument doc;
+ 
                                // Validate the parameters.
                                if(oldChild.ParentNode != this)
***************
*** 752,756 ****
                                args = EmitBefore(XmlNodeChangedAction.Remove, 
this, null);
  
!                               // Remove the child.
                                NodeList.GetList(this).RemoveChild(oldChild);
  
--- 919,933 ----
                                args = EmitBefore(XmlNodeChangedAction.Remove, 
this, null);
  
!                               // Remove the child from this node and 
re-associate
!                               // it with the placeholder document fragment.
!                               if(this is XmlDocument)
!                               {
!                                       doc = (XmlDocument)this;
!                               }
!                               else
!                               {
!                                       doc = OwnerDocument;
!                               }
!                               oldChild.parent = doc.Placeholder;
                                NodeList.GetList(this).RemoveChild(oldChild);
  
***************
*** 822,830 ****
        public abstract void WriteTo(XmlWriter w);
  
        // Clone the children from another node into this node.
-       [TODO]
        internal void CloneChildrenFrom(XmlNode other, bool deep)
                        {
!                               // TODO
                        }
  
--- 999,1022 ----
        public abstract void WriteTo(XmlWriter w);
  
+       // Write the children of this node to a specified XmlWriter.
+       internal void WriteChildrenTo(XmlWriter w)
+                       {
+                               XmlNode child = NodeList.GetFirstChild(this);
+                               while(child != null)
+                               {
+                                       child.WriteTo(w);
+                                       child = NodeList.GetNextSibling(child);
+                               }
+                       }
+ 
        // Clone the children from another node into this node.
        internal void CloneChildrenFrom(XmlNode other, bool deep)
                        {
!                               XmlNode child = NodeList.GetFirstChild(other);
!                               while(child != null)
!                               {
!                                       AppendChild(child.CloneNode(deep));
!                                       child = NodeList.GetNextSibling(child);
!                               }
                        }
  
***************
*** 875,878 ****
--- 1067,1071 ----
                                if(doc != null)
                                {
+                                       XmlNode parent = ParentNode;
                                        return doc.EmitBefore(action, this, 
parent, parent);
                                }

Index: XmlProcessingInstruction.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlProcessingInstruction.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** XmlProcessingInstruction.cs 4 Dec 2002 06:25:59 -0000       1.1
--- XmlProcessingInstruction.cs 6 Dec 2002 04:58:32 -0000       1.2
***************
*** 46,49 ****
--- 46,50 ----
  
        // Get or set the data associated with a processing instruction.
+       [TODO]
        public String Data
                        {
***************
*** 60,63 ****
--- 61,65 ----
  
        // Get or set the inner text associated with this processing 
instruction.
+       [TODO]
        public override String InnerText
                        {

Index: XmlText.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlText.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** XmlText.cs  4 Dec 2002 04:46:35 -0000       1.1
--- XmlText.cs  6 Dec 2002 04:58:32 -0000       1.2
***************
*** 76,81 ****
                                {
                                        Data = value;
-                                       // TODO: if the parent is an attribute, 
then
-                                       // set its "specified" property.
                                }
                        }
--- 76,79 ----

Index: XmlTextReader.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlTextReader.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** XmlTextReader.cs    5 Dec 2002 22:19:53 -0000       1.9
--- XmlTextReader.cs    6 Dec 2002 04:58:32 -0000       1.10
***************
*** 34,37 ****
--- 34,38 ----
        private bool namespaces;
        private bool normalize;
+       private char quoteChar;
        private XmlNameTable nameTable;
        private XmlNamespaceManager namespaceManager;
***************
*** 65,68 ****
--- 66,70 ----
                                namespaces = true;
                                normalize = false;
+                               quoteChar = '"';
                                nameTable = nt;
                                namespaceManager = new XmlNamespaceManager(nt);
***************
*** 1029,1041 ****
                                get
                                {
!                                       XmlAttribute attr = (currentNode as 
XmlAttribute);
!                                       if(attr != null)
!                                       {
!                                               return attr.quoteChar;
!                                       }
!                                       else
!                                       {
!                                               return '"';
!                                       }
                                }
                        }
--- 1031,1035 ----
                                get
                                {
!                                       return quoteChar;
                                }
                        }

Index: XmlTextWriter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlTextWriter.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** XmlTextWriter.cs    2 Dec 2002 23:55:43 -0000       1.3
--- XmlTextWriter.cs    6 Dec 2002 04:58:32 -0000       1.4
***************
*** 45,48 ****
--- 45,49 ----
        private int pseudoNSNumber;
        private bool prevWasText;
+       internal bool autoShiftToContent;
        private enum Special
        {
***************
*** 95,98 ****
--- 96,100 ----
                                prevWasText = false;
                                special = Special.None;
+                               autoShiftToContent = false;
                        }
  
***************
*** 225,228 ****
--- 227,254 ----
  
                                        case WriteState.Start:
+                                       {
+                                               // Automatically shift to the 
content mode
+                                               // if we are outputting a 
document fragment
+                                               // from "XmlNode.InnerXml" or 
"XmlNode.OuterXml".
+                                               if(autoShiftToContent)
+                                               {
+                                                       if((flags & 
WriteStateFlag.ContentFlag) == 0)
+                                                       {
+                                                               throw new 
InvalidOperationException
+                                                                       
(S._("Xml_InvalidWriteState"));
+                                                       }
+                                                       writeState = 
WriteState.Content;
+                                               }
+                                               else
+                                               {
+                                                       if(((1 << 
(int)writeState) & (int)flags) == 0)
+                                                       {
+                                                               throw new 
InvalidOperationException
+                                                                       
(S._("Xml_InvalidWriteState"));
+                                                       }
+                                               }
+                                       }
+                                       break;
+ 
                                        case WriteState.Prolog:
                                        case WriteState.Closed:
***************
*** 254,258 ****
                                                writer.Write(quoteChar);
                                                writer.Write(" />");
!                                               PopScope();
                                                if(xmlSpace != 
System.Xml.XmlSpace.Preserve)
                                                {
--- 280,287 ----
                                                writer.Write(quoteChar);
                                                writer.Write(" />");
!                                               if(scope != null)
!                                               {
!                                                       PopScope();
!                                               }
                                                if(xmlSpace != 
System.Xml.XmlSpace.Preserve)
                                                {
***************
*** 262,268 ****
                                        else if(writeState == 
System.Xml.WriteState.Element)
                                        {
!                                               // Terminate the element start.
!                                               writer.Write(" />");
!                                               PopScope();
                                        }
                                        while(scope != null)
--- 291,302 ----
                                        else if(writeState == 
System.Xml.WriteState.Element)
                                        {
!                                               // Terminate the element start. 
 We may need
!                                               // to ignore this if writing in 
"auto-shift"
!                                               // mode as we may have written 
a bare attribute.
!                                               if(scope != null || 
!autoShiftToContent)
!                                               {
!                                                       writer.Write(" />");
!                                                       PopScope();
!                                               }
                                        }
                                        while(scope != null)
***************
*** 323,330 ****
--- 357,366 ----
                                }
                                Sync(WriteStateFlag.ContentFlag);
+                               writer.Write("<![CDATA[");
                                if(text != null)
                                {
                                        writer.Write(text);
                                }
+                               writer.Write("]]>");
                        }
  
***************
*** 758,767 ****
                                }
  
!                               // We need to be in the "Element" state.
                                if(writeState == 
System.Xml.WriteState.Attribute)
                                {
                                        writer.Write(quoteChar);
                                }
!                               else if(writeState != 
System.Xml.WriteState.Element)
                                {
                                        throw new InvalidOperationException
--- 794,808 ----
                                }
  
!                               // Check the state and output delimiters.
                                if(writeState == 
System.Xml.WriteState.Attribute)
                                {
                                        writer.Write(quoteChar);
+                                       writer.Write(' ');
+                               }
+                               else if(writeState == 
System.Xml.WriteState.Element)
+                               {
+                                       writer.Write(' ');
                                }
!                               else if(writeState == 
System.Xml.WriteState.Closed)
                                {
                                        throw new InvalidOperationException
***************
*** 770,775 ****
  
                                // Output the name of the attribute, with 
appropriate prefixes.
!                               writer.Write(' ');
!                               if(((Object)prefix) != null && ((Object)ns) != 
null)
                                {
                                        // We need to associate a prefix with a 
namespace.
--- 811,816 ----
  
                                // Output the name of the attribute, with 
appropriate prefixes.
!                               if(((Object)prefix) != null && prefix != 
String.Empty &&
!                                  ((Object)ns) != null && ns != String.Empty)
                                {
                                        // We need to associate a prefix with a 
namespace.
***************
*** 799,803 ****
                                        }
                                }
!                               else if(((Object)prefix) != null)
                                {
                                        // We were only given a prefix, so 
output it directly.
--- 840,844 ----
                                        }
                                }
!                               else if(((Object)prefix) != null && prefix != 
String.Empty)
                                {
                                        // We were only given a prefix, so 
output it directly.
***************
*** 808,812 ****
                                        }
                                }
!                               else if(((Object)ns) != null)
                                {
                                        // We were only given a namespace, so 
find the prefix.
--- 849,853 ----
                                        }
                                }
!                               else if(((Object)ns) != null && ns != 
String.Empty)
                                {
                                        // We were only given a namespace, so 
find the prefix.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]