dotgnu-general
[Top][All Lists]
Advanced

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

[DotGNU]System.Xml.XmlTextWriter WriteProcessingInstruction()


From: minddog
Subject: [DotGNU]System.Xml.XmlTextWriter WriteProcessingInstruction()
Date: Sat, 28 Dec 2002 08:42:29 -0700
User-agent: KMail/1.4.3

Hey, I worked for a couple hours on this dunno how ecma correct it is, but 
give it some kicks and tell me what you think...

I attached the diff and displayed it here:
Index: XmlTextWriter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Xml/XmlTextWriter.cs,v
retrieving revision 1.8
diff -u -r1.8 XmlTextWriter.cs
--- XmlTextWriter.cs    13 Dec 2002 03:45:07 -0000      1.8
+++ XmlTextWriter.cs    28 Dec 2002 15:37:56 -0000
@@ -776,10 +776,31 @@
                                writer.Write(name);
                        }
 
-       // Write a processing instruction.
+       // Write a processing instruction. <?name text?>
        public override void WriteProcessingInstruction(String name, String 
text)
-                       {
-                               // TODO
+                       {                                               
+
+                               if((writeState == System.Xml.WriteState.Start) 
|| (name == null)) 
+                               {
+                                       throw new ArgumentException
+                                               (S._("Xml_ArgumentException"), 
"name");
+                                       
+                               }
+                               if(writeState == System.Xml.WriteState.Closed)  
+                               {
+
+                                       throw new InvalidOperationException
+                                               (S._("Xml_InvalidOperation"));
+                               }
+
+                               Sync(WriteStateFlag.PrologFlag); 
+
+                               if (text != null) 
+                               {
+                                       writer.WriteLine("<?{0} {1}?>",name, 
text);
+                               } else {
+                                       writer.WriteLine("<?{0}?>",name);
+                               }
                        }
 
        // Write a qualified name.


-- 
--minddog( Adam Ballai )

"I try to take it one day at a time, but several of them attack me at once."
-mistyflip

Attachment: XmlTextWriter.diff
Description: Text Data


reply via email to

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