Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2007-08-21 16:21:01 +0400
committerAtsushi Eno <atsushieno@gmail.com>2007-08-21 16:21:01 +0400
commit1da39baea9d6241911518dbf7d1d6e848d857267 (patch)
tree64a6f54952f852856a0f948fbc90dbe7f20c3f2b /mcs/class/System.XML/System.Xml.Serialization
parent24898ccf3eead67feab8aa4d5c2a5089bf31a049 (diff)
2007-08-21 Atsushi Enomoto <atsushi@ximian.com>
* XmlSerializationReader.cs : implemented ReaderCount and CheckReaderCount(). svn path=/trunk/mcs/; revision=84543
Diffstat (limited to 'mcs/class/System.XML/System.Xml.Serialization')
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/ChangeLog5
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs39
2 files changed, 40 insertions, 4 deletions
diff --git a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
index 8aae5a41ef4..ad53cc93cec 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
+++ b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
@@ -1,5 +1,10 @@
2007-08-21 Atsushi Enomoto <atsushi@ximian.com>
+ * XmlSerializationReader.cs :
+ implemented ReaderCount and CheckReaderCount().
+
+2007-08-21 Atsushi Enomoto <atsushi@ximian.com>
+
* MapCodeGenerator.cs : avoid possible duplicates in generated field
names. Fixed bug #82078.
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs
index 72c458ab653..14c50029943 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs
@@ -64,6 +64,7 @@ namespace System.Xml.Serialization
XmlSerializer eventSource;
int delayedFixupId = 0;
Hashtable referencedObjects;
+ int readCount, whileIterationCount;
string w3SchemaNS;
string w3InstanceNS;
@@ -140,6 +141,11 @@ namespace System.Xml.Serialization
}
+#if NET_2_0
+ protected int ReaderCount {
+ get { return readCount; }
+ }
+#endif
#region Methods
@@ -270,10 +276,10 @@ namespace System.Xml.Serialization
}
#if NET_2_0
- [MonoNotSupported("")]
protected void CheckReaderCount (ref int whileIterations, ref int readerCount)
{
- throw new NotImplementedException ();
+ whileIterations = whileIterationCount;
+ readerCount = readCount;
}
#endif
@@ -390,6 +396,8 @@ namespace System.Xml.Serialization
protected XmlQualifiedName ReadElementQualifiedName ()
{
+ readCount++;
+
if (reader.IsEmptyElement) {
reader.Skip();
return ToXmlQualifiedName (String.Empty);
@@ -403,6 +411,8 @@ namespace System.Xml.Serialization
protected void ReadEndElement ()
{
+ readCount++;
+
while (reader.NodeType == XmlNodeType.Whitespace)
reader.Skip ();
@@ -418,6 +428,8 @@ namespace System.Xml.Serialization
if (!GetNullAttr ())
return false;
+ readCount++;
+
if (reader.IsEmptyElement) {
reader.Skip();
return true;
@@ -444,6 +456,7 @@ namespace System.Xml.Serialization
if (ReadNull ())
return null;
+ readCount++;
return reader.ReadElementString ();
}
@@ -459,6 +472,7 @@ namespace System.Xml.Serialization
throw new InvalidOperationException("href not found: " + href);
fixupReference = href.Substring (1);
+ readCount++;
if (!reader.IsEmptyElement) {
reader.ReadStartElement ();
ReadEndElement ();
@@ -560,12 +574,15 @@ namespace System.Xml.Serialization
bool listComplete = true;
- if (Reader.IsEmptyElement)
+ if (Reader.IsEmptyElement) {
+ readCount++;
Reader.Skip ();
- else {
+ } else {
Reader.ReadStartElement ();
for (int n=0; n<count; n++)
{
+ whileIterationCount++;
+ readCount++;
Reader.MoveToContent ();
string id;
object item = ReadReferencingElement (itemType, qn.Namespace, out id);
@@ -577,6 +594,7 @@ namespace System.Xml.Serialization
listComplete = false;
}
}
+ whileIterationCount = 0;
Reader.ReadEndElement ();
}
@@ -589,10 +607,13 @@ namespace System.Xml.Serialization
reader.MoveToContent();
XmlNodeType nt = reader.NodeType;
while (nt != XmlNodeType.EndElement && nt != XmlNodeType.None) {
+ whileIterationCount++;
+ readCount++;
ReadReferencedElement ();
reader.MoveToContent ();
nt = reader.NodeType;
}
+ whileIterationCount = 0;
// Registers delayed list
@@ -687,6 +708,7 @@ namespace System.Xml.Serialization
{
if (refid.StartsWith ("#")) refid = refid.Substring (1);
+ readCount++;
Reader.Skip ();
if (TargetReady (refid))
{
@@ -705,6 +727,7 @@ namespace System.Xml.Serialization
{
if (ReadNull ()) return null;
int depth = reader.Depth;
+ readCount++;
serializable.ReadXml (reader);
Reader.MoveToContent ();
while (reader.Depth > depth)
@@ -716,6 +739,7 @@ namespace System.Xml.Serialization
protected string ReadString (string value)
{
+ readCount++;
if (value == null || value == String.Empty)
return reader.ReadString ();
@@ -735,6 +759,7 @@ namespace System.Xml.Serialization
if (typeData == null || typeData.SchemaType != SchemaTypes.Primitive)
{
// Put everything into a node array
+ readCount++;
XmlNode node = Document.ReadNode (reader);
if (reportUnknown)
@@ -759,11 +784,13 @@ namespace System.Xml.Serialization
}
if (typeData.Type == typeof (XmlQualifiedName)) return ReadNullableQualifiedName ();
+ readCount++;
return XmlCustomFormatter.FromXmlString (typeData, Reader.ReadElementString ());
}
protected XmlNode ReadXmlNode (bool wrapped)
{
+ readCount++;
XmlNode node = Document.ReadNode (reader);
if (wrapped)
return node.FirstChild;
@@ -773,6 +800,8 @@ namespace System.Xml.Serialization
protected XmlDocument ReadXmlDocument (bool wrapped)
{
+ readCount++;
+
if (wrapped)
reader.ReadStartElement ();
@@ -807,6 +836,7 @@ namespace System.Xml.Serialization
protected byte[] ToByteArrayBase64 (bool isNull)
{
+ readCount++;
if (isNull) {
Reader.ReadString ();
return null;
@@ -822,6 +852,7 @@ namespace System.Xml.Serialization
protected byte[] ToByteArrayHex (bool isNull)
{
+ readCount++;
if (isNull) {
Reader.ReadString ();
return null;