[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnetlib ChangeLog System.Xml/XmlTextWriter.cs S...
From: |
Heiko Weiss |
Subject: |
[dotgnu-pnet-commits] pnetlib ChangeLog System.Xml/XmlTextWriter.cs S... |
Date: |
Tue, 17 Oct 2006 11:40:03 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: pnetlib
Changes by: Heiko Weiss <brubbel> 06/10/17 11:40:03
Modified files:
. : ChangeLog
System.Xml : XmlTextWriter.cs
System.Xml/Private: XmlFragmentTextWriter.cs
Log message:
fixed WriteXmlDeclaration for XmlDocument.OuterXml not to use
the textwriter encoding attribute (which is always utf-16), but the
encoding attribute of the XmlDocument itself.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2440&r2=1.2441
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Xml/XmlTextWriter.cs?cvsroot=dotgnu-pnet&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Xml/Private/XmlFragmentTextWriter.cs?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2440
retrieving revision 1.2441
diff -u -b -r1.2440 -r1.2441
--- ChangeLog 13 Oct 2006 07:41:33 -0000 1.2440
+++ ChangeLog 17 Oct 2006 11:40:02 -0000 1.2441
@@ -1,3 +1,11 @@
+2006-10-17 Heiko Weiss <address@hidden>
+
+ * System.Xml/XmlTextWriter.cs,
+ System.Xml/Private/XmlFragmentTextWriter.cs:
+ fixed WriteXmlDeclaration for XmlDocument.OuterXml not to use
+ the textwriter encoding attribute (which is always utf-16), but the
+ encoding attribute of the XmlDocument itself.
+
2006-10-13 Klaus Treichel <address@hidden>
* runtime/System/Diagnostics/DebuggableAttribute.cs: Add 2.0 features.
Index: System.Xml/XmlTextWriter.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System.Xml/XmlTextWriter.cs,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- System.Xml/XmlTextWriter.cs 6 Mar 2006 12:28:09 -0000 1.33
+++ System.Xml/XmlTextWriter.cs 17 Oct 2006 11:40:03 -0000 1.34
@@ -42,8 +42,8 @@
private SpecialWriter specialWriter;
private String nsPrefix;
private String xmlLang;
- private WriteState writeState;
- private XmlNameTable nameTable;
+ protected WriteState writeState; // need protected for
XmlFragmentTextWriter
+ protected XmlNameTable nameTable; // need protected for
XmlFragmentTextWriter
private XmlNamespaceManager namespaceManager;
private XmlSpace xmlSpace;
internal bool autoShiftToContent;
@@ -506,7 +506,7 @@
}
// Write an xml declaration.
- private void WriteXmlDeclaration(String text)
+ virtual protected void WriteXmlDeclaration(String text)
{
// make sure we're in the start state
if(writeState != System.Xml.WriteState.Start)
Index: System.Xml/Private/XmlFragmentTextWriter.cs
===================================================================
RCS file:
/sources/dotgnu-pnet/pnetlib/System.Xml/Private/XmlFragmentTextWriter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- System.Xml/Private/XmlFragmentTextWriter.cs 7 Feb 2004 13:17:24 -0000
1.1
+++ System.Xml/Private/XmlFragmentTextWriter.cs 17 Oct 2006 11:40:03 -0000
1.2
@@ -74,6 +74,67 @@
base.WriteStartElement(prefix, localName, ns);
}
+ protected override void WriteXmlDeclaration(String text)
+ {
+ // make sure we're in the start state
+ if(writeState != System.Xml.WriteState.Start)
+ {
+ throw new InvalidOperationException
+
(S._("Xml_InvalidWriteState"));
+ }
+
+ // create the reader
+ XmlTextReader r = new XmlTextReader
+ (new StringReader("<?xml
"+text+"?>"), nameTable);
+
+ // read the value
+ r.Read();
+
+ // read the version attribute
+ if(r["version"] != "1.0")
+ {
+ throw new ArgumentException
+
(S._("Xml_InvalidVersion"), "text");
+ }
+
+ bool haveEncoding = false;
+#if !ECMA_COMPAT
+ // make sure the encoding matches
+ String encoding = r["encoding"];
+ if(encoding != null && encoding.Length > 0 )
+ {
+ haveEncoding = true;
+ }
+#endif
+
+ // make sure the standalone is valid
+ String standalone = r["standalone"];
+ bool haveStandalone = false;
+ if(standalone != null && standalone.Length > 0)
+ {
+ if(standalone != "yes" && standalone !=
"no")
+ {
+ throw new ArgumentException
+
(S._("Xml_InvalidEncoding"), "text");
+ }
+ haveStandalone = true;
+ }
+
+ // write the start of the document
+ string start = "<?xml version=\"1.0\"";
+ if( haveEncoding ) {
+ start += " encoding=\"" + encoding +
"\"";
+ }
+ if( haveStandalone ) {
+ start += " standalone=\"" + standalone;
+ }
+ start += "\"?>";
+
+ writer.Write( start );
+ writeState = System.Xml.WriteState.Prolog;
+ }
+
+
}; // class XmlFragmentTextWriter
}; // namespace System.Xml.Private
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnetlib ChangeLog System.Xml/XmlTextWriter.cs S...,
Heiko Weiss <=