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 XmlEntity.cs,NONE,1.1 XmlN


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System.Xml XmlEntity.cs,NONE,1.1 XmlNotation.cs,NONE,1.1 XmlDocument.cs,1.6,1.7 XmlDocumentFragment.cs,1.3,1.4 XmlDocumentType.cs,1.3,1.4 XmlTextReader.cs,1.10,1.11 XmlTextWriter.cs,1.4,1.5
Date: Sat, 07 Dec 2002 02:34:17 -0500

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

Modified Files:
        XmlDocument.cs XmlDocumentFragment.cs XmlDocumentType.cs 
        XmlTextReader.cs XmlTextWriter.cs 
Added Files:
        XmlEntity.cs XmlNotation.cs 
Log Message:


More test cases and bug fixes for System.Xml.


--- NEW FILE ---
/*
 * XmlEntity.cs - Implementation of the "System.Xml.XmlEntity" class.
 *
 * Copyright (C) 2002 Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Xml
{

using System;

#if ECMA_COMPAT
internal
#else
public
#endif
class XmlEntity : XmlNode
{
        // Internal state.
        private String name;
        private String notation;
        private String publicId;
        private String systemId;

        // Constructor.
        internal XmlEntity(XmlNode parent, String name, String notation,
                                           String publicId, String systemId)
                        : base(parent)
                        {
                                this.name = name;
                                this.notation = notation;
                                this.publicId = publicId;
                                this.systemId = systemId;
                        }

        // Get the base URI for this node.
        public override String BaseURI
                        {
                                get
                                {
                                        return base.BaseURI;
                                }
                        }

        // Get the inner text version of this node.
        public override String InnerText
                        {
                                get
                                {
                                        return base.InnerText;
                                }
                                set
                                {
                                        throw new 
InvalidOperationException(S._("Xml_ReadOnly"));
                                }
                        }

        // Get the markup that represents the children of this node.
        public override String InnerXml
                        {
                                get
                                {
                                        return String.Empty;
                                }
                                set
                                {
                                        throw new InvalidOperationException
                                                (S._("Xml_CannotSetInnerXml"));
                                }
                        }

        // Determine if this entity reference is read-only.
        public override bool IsReadOnly
                        {
                                get
                                {
                                        return true;
                                }
                        }

        // Get the local name associated with this node.
        public override String LocalName
                        {
                                get
                                {
                                        return name;
                                }
                        }

        // Get the name associated with this node.
        public override String Name
                        {
                                get
                                {
                                        return name;
                                }
                        }

        // Get the type that is associated with this node.
        public override XmlNodeType NodeType
                        {
                                get
                                {
                                        return XmlNodeType.Entity;
                                }
                        }

        // Get the notation name.
        public String NotationName
                        {
                                get
                                {
                                        return notation;
                                }
                        }

        // Get the XML markup representing this node and all of its children.
        public override String OuterXml
                        {
                                get
                                {
                                        return String.Empty;
                                }
                        }

        // Get the public identifier for this entity.
        public String PublicId
                        {
                                get
                                {
                                        return publicId;
                                }
                        }

        // Get the system identifier for this entity.
        public String SystemId
                        {
                                get
                                {
                                        return systemId;
                                }
                        }

        // Clone this node in either shallow or deep mode.
        public override XmlNode CloneNode(bool deep)
                        {
                                throw new 
InvalidOperationException(S._("Xml_CannotClone"));
                        }

        // Writes the contents of this node to a specified XmlWriter.
        public override void WriteContentTo(XmlWriter w)
                        {
                                // Nothing to do here.
                        }

        // Write this node and all of its contents to a specified XmlWriter.
        public override void WriteTo(XmlWriter w)
                        {
                                // Nothing to do here.
                        }

}; // class XmlEntity

}; // namespace System.Xml

--- NEW FILE ---
/*
 * XmlNotation.cs - Implementation of the "System.Xml.XmlNotation" class.
 *
 * Copyright (C) 2002 Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Xml
{

using System;

#if ECMA_COMPAT
internal
#else
public
#endif
class XmlNotation : XmlNode
{
        // Internal state.
        private String name;
        private String publicId;
        private String systemId;

        // Constructor.
        internal XmlNotation(XmlNode parent, String name,
                                             String publicId, String systemId)
                        : base(parent)
                        {
                                this.name = name;
                                this.publicId = publicId;
                                this.systemId = systemId;
                        }

        // Get the markup that represents the children of this node.
        public override String InnerXml
                        {
                                get
                                {
                                        return String.Empty;
                                }
                                set
                                {
                                        throw new InvalidOperationException
                                                (S._("Xml_CannotSetInnerXml"));
                                }
                        }

        // Determine if this entity reference is read-only.
        public override bool IsReadOnly
                        {
                                get
                                {
                                        return true;
                                }
                        }

        // Get the local name associated with this node.
        public override String LocalName
                        {
                                get
                                {
                                        return name;
                                }
                        }

        // Get the name associated with this node.
        public override String Name
                        {
                                get
                                {
                                        return name;
                                }
                        }

        // Get the type that is associated with this node.
        public override XmlNodeType NodeType
                        {
                                get
                                {
                                        return XmlNodeType.Notation;
                                }
                        }

        // Get the XML markup representing this node and all of its children.
        public override String OuterXml
                        {
                                get
                                {
                                        return String.Empty;
                                }
                        }

        // Get the public identifier for this notation.
        public String PublicId
                        {
                                get
                                {
                                        return publicId;
                                }
                        }

        // Get the system identifier for this notation.
        public String SystemId
                        {
                                get
                                {
                                        return systemId;
                                }
                        }

        // Clone this node in either shallow or deep mode.
        public override XmlNode CloneNode(bool deep)
                        {
                                throw new 
InvalidOperationException(S._("Xml_CannotClone"));
                        }

        // Writes the contents of this node to a specified XmlWriter.
        public override void WriteContentTo(XmlWriter w)
                        {
                                // Nothing to do here.
                        }

        // Write this node and all of its contents to a specified XmlWriter.
        public override void WriteTo(XmlWriter w)
                        {
                                // Nothing to do here.
                        }

}; // class XmlNotation

}; // namespace System.Xml

Index: XmlDocument.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlDocument.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** XmlDocument.cs      6 Dec 2002 04:58:32 -0000       1.6
--- XmlDocument.cs      7 Dec 2002 07:34:14 -0000       1.7
***************
*** 23,26 ****
--- 23,28 ----
  
  using System;
+ using System.IO;
+ using System.Text;
  
  #if ECMA_COMPAT
***************
*** 224,228 ****
  
        // Clone this document node.
-       [TODO]
        public override XmlNode CloneNode(bool deep)
                        {
--- 226,229 ----
***************
*** 231,236 ****
                                if(deep)
                                {
!                                       // Copy across the children.
!                                       // TODO
                                }
                                return doc;
--- 232,236 ----
                                if(deep)
                                {
!                                       doc.CloneChildrenFrom(this, deep);
                                }
                                return doc;
***************
*** 591,606 ****
                        }
  
!       // Write the contents of this document to an XML writer.
        [TODO]
!       public override void WriteContentTo(XmlWriter xw)
                        {
                                // TODO
                        }
  
!       // Write this document to an XML writer.
        [TODO]
!       public override void WriteTo(XmlWriter w)
                        {
                                // TODO
                        }
  
--- 591,696 ----
                        }
  
!       // Get an element by identifier.
        [TODO]
!       public virtual XmlElement GetElementById(String elementId)
                        {
                                // TODO
+                               return null;
                        }
  
!       // Get a list of elements by tag name.
        [TODO]
!       public virtual XmlNodeList GetElementsByTagName(String name)
!                       {
!                               // TODO
!                               return null;
!                       }
! 
!       // Get a list of elements by local name and namespace.
!       [TODO]
!       public virtual XmlNodeList GetElementsByTagName
!                               (String name, String namespaceURI)
!                       {
!                               // TODO
!                               return null;
!                       }
! 
!       // Import a node from another document.
!       [TODO]
!       public virtual XmlNode ImportNode(XmlNode node, bool deep)
                        {
                                // TODO
+                               return null;
+                       }
+ 
+       // Load XML into this document.
+       [TODO]
+       public virtual void Load(Stream inStream)
+                       {
+                               // TODO
+                       }
+       [TODO]
+       public virtual void Load(String filename)
+                       {
+                               // TODO
+                       }
+       [TODO]
+       public virtual void Load(TextReader txtReader)
+                       {
+                               // TODO
+                       }
+       [TODO]
+       public virtual void Load(XmlReader reader)
+                       {
+                               // TODO
+                       }
+ 
+       // Load XML into this document from a string.
+       [TODO]
+       public virtual void LoadXml(String xml)
+                       {
+                               // TODO
+                       }
+ 
+       // Read a node into this document.
+       [TODO]
+       public virtual XmlNode ReadNode(XmlReader reader)
+                       {
+                               // TODO
+                               return null;
+                       }
+ 
+       // Save XML data from this document.
+       [TODO]
+       public virtual void Save(Stream outStream)
+                       {
+                               // TODO
+                       }
+       [TODO]
+       public virtual void Save(String filename)
+                       {
+                               // TODO
+                       }
+       [TODO]
+       public virtual void Save(TextWriter writer)
+                       {
+                               // TODO
+                       }
+       [TODO]
+       public virtual void Save(XmlWriter w)
+                       {
+                               // TODO
+                       }
+ 
+       // Write the contents of this document to an XML writer.
+       public override void WriteContentTo(XmlWriter xw)
+                       {
+                               WriteChildrenTo(xw);
+                       }
+ 
+       // Write this document to an XML writer.
+       public override void WriteTo(XmlWriter w)
+                       {
+                               WriteContentTo(w);
                        }
  

Index: XmlDocumentFragment.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlDocumentFragment.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** XmlDocumentFragment.cs      6 Dec 2002 04:58:32 -0000       1.3
--- XmlDocumentFragment.cs      7 Dec 2002 07:34:14 -0000       1.4
***************
*** 47,52 ****
                                get
                                {
!                                       // TODO
!                                       return null;
                                }
                                set
--- 47,51 ----
                                get
                                {
!                                       return base.InnerXml;
                                }
                                set
***************
*** 121,135 ****
  
        // Write the contents of this document to an XML writer.
!       [TODO]
!       public override void WriteContentTo(XmlWriter xw)
                        {
!                               // TODO
                        }
  
        // Write this document to an XML writer.
-       [TODO]
        public override void WriteTo(XmlWriter w)
                        {
!                               // TODO
                        }
  
--- 120,132 ----
  
        // Write the contents of this document to an XML writer.
!       public override void WriteContentTo(XmlWriter w)
                        {
!                               WriteTo(w);
                        }
  
        // Write this document to an XML writer.
        public override void WriteTo(XmlWriter w)
                        {
!                               WriteChildrenTo(w);
                        }
  

Index: XmlDocumentType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlDocumentType.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** XmlDocumentType.cs  5 Dec 2002 22:19:53 -0000       1.3
--- XmlDocumentType.cs  7 Dec 2002 07:34:14 -0000       1.4
***************
*** 47,59 ****
                        {
                                XmlNameTable nt = 
parent.FindOwnerQuick().NameTable;
!                               this.name =
!                                       ((name != null) ? nt.Add(name) : 
String.Empty);
!                               this.publicId =
!                                       ((publicId != null) ? nt.Add(publicId) 
: String.Empty);
!                               this.systemId =
!                                       ((systemId != null) ? nt.Add(systemId) 
: String.Empty);
!                               this.internalSubset =
!                                       ((internalSubset != null) ? 
nt.Add(internalSubset)
!                                                                               
          : String.Empty);
                                entities = new XmlNamedNodeMap(this);
                                notations = new XmlNamedNodeMap(this);
--- 47,54 ----
                        {
                                XmlNameTable nt = 
parent.FindOwnerQuick().NameTable;
!                               this.name = name;
!                               this.publicId = publicId;
!                               this.systemId = systemId;
!                               this.internalSubset = internalSubset;
                                entities = new XmlNamedNodeMap(this);
                                notations = new XmlNamedNodeMap(this);

Index: XmlTextReader.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlTextReader.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** XmlTextReader.cs    6 Dec 2002 04:58:32 -0000       1.10
--- XmlTextReader.cs    7 Dec 2002 07:34:14 -0000       1.11
***************
*** 597,601 ****
                                                else if(ch == '[')
                                                {
!                                                       // TODO: CDATA and 
document type nodes.
                                                }
                                                else
--- 597,605 ----
                                                else if(ch == '[')
                                                {
!                                                       // TODO: CDATA nodes.
!                                               }
!                                               else if(ch == 'D')
!                                               {
!                                                       // TODO: document type 
nodes.
                                                }
                                                else

Index: XmlTextWriter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlTextWriter.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** XmlTextWriter.cs    6 Dec 2002 04:58:32 -0000       1.4
--- XmlTextWriter.cs    7 Dec 2002 07:34:14 -0000       1.5
***************
*** 539,546 ****
                        {
                                // We must be in the prolog.
!                               if(writeState != System.Xml.WriteState.Prolog)
                                {
!                                       throw new InvalidOperationException
!                                               (S._("Xml_InvalidWriteState"));
                                }
  
--- 539,557 ----
                        {
                                // We must be in the prolog.
!                               if(autoShiftToContent)
                                {
!                                       if(writeState == 
System.Xml.WriteState.Closed)
!                                       {
!                                               throw new 
InvalidOperationException
!                                                       
(S._("Xml_InvalidWriteState"));
!                                       }
!                               }
!                               else
!                               {
!                                       if(writeState != 
System.Xml.WriteState.Prolog)
!                                       {
!                                               throw new 
InvalidOperationException
!                                                       
(S._("Xml_InvalidWriteState"));
!                                       }
                                }
  
***************
*** 555,570 ****
                                writer.Write("<!DOCTYPE ");
                                writer.Write(name);
!                               writer.Write(" PUBLIC \"");
!                               WriteQuotedString(pubid);
!                               writer.Write("\" \"");
!                               WriteQuotedString(sysid);
!                               writer.Write('\"');
!                               if(subset != null && subset.Length != 0)
!                               {
!                                       writer.Write(" \"");
!                                       WriteQuotedString(subset);
!                                       writer.Write('\"');
                                }
!                               writer.WriteLine('>');
  
                                // Return to the prolog.
--- 566,596 ----
                                writer.Write("<!DOCTYPE ");
                                writer.Write(name);
!                               writeState = System.Xml.WriteState.Attribute;
!                               if(pubid != null)
!                               {
!                                       writer.Write(" PUBLIC ");
!                                       writer.Write(quoteChar);
!                                       WriteQuotedString(pubid);
!                                       writer.Write(quoteChar);
!                                       writer.Write(' ');
!                                       writer.Write(quoteChar);
!                                       WriteQuotedString(sysid);
!                                       writer.Write(quoteChar);
!                               }
!                               else if(sysid != null)
!                               {
!                                       writer.Write(" SYSTEM ");
!                                       writer.Write(quoteChar);
!                                       WriteQuotedString(sysid);
!                                       writer.Write(quoteChar);
!                               }
!                               if(subset != null)
!                               {
!                                       writer.Write(' ');
!                                       writer.Write('[');
!                                       writer.Write(subset);
!                                       writer.Write(']');
                                }
!                               writer.Write('>');
  
                                // Return to the prolog.
***************
*** 1147,1151 ****
                                                default:
                                                {
!                                                       if(ch < 0x20)
                                                        {
                                                                // Quote a 
low-ASCII control character.
--- 1173,1177 ----
                                                default:
                                                {
!                                                       if(ch < 0x20 && 
!Char.IsWhiteSpace(ch))
                                                        {
                                                                // Quote a 
low-ASCII control character.




reply via email to

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