[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-patches
Subject: [Mono-patches] r47874 - in trunk/mcs/class/Commons.Xml.Relaxng:
From: "Atsushi Enomoto (ginga () kit ! hi-ho ! ne ! jp)" <atsushi () mono-cvs ! ximian ! com>
Date: 2005-07-31 13:18:49
Message-ID: 20050731131849.0CED29472C () mono-cvs ! ximian ! com
[Download RAW message or body]
Author: atsushi
Date: 2005-07-31 09:18:48 -0400 (Sun, 31 Jul 2005)
New Revision: 47874
Modified:
trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/ChangeLog
trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/RdpPatterns.cs
trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/ChangeLog
trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/RelaxngGrammar.cs
Log:
2005-07-31 Atsushi Enomoto <atsushi@ximian.com>
* RdpPattern.cs : GetLabels() for RdpGroup should check attributes
when the left branch is not nullable (it works like an interleave).
Implemented spec 7.3 attribute check (though not enabled for now).
* RelaxngGrammar.cs : spec 7.3 check is kinda implemented but cannot
verify now because of weird exception handling in the runtime.
Modified: trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/ChangeLog
===================================================================
--- trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/ChangeLog 2005-07-31 \
12:06:38 UTC (rev 47873)
+++ trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/ChangeLog 2005-07-31 \
13:18:48 UTC (rev 47874) @@ -1,3 +1,8 @@
+2005-07-31 Atsushi Enomoto <atsushi@ximian.com>
+
+ * RelaxngGrammar.cs : spec 7.3 check is kinda implemented but cannot
+ verify now because of weird exception handling in the runtime.
+
2005-06-07 Atsushi Enomoto <atsushi@ximian.com>
* RelaxngReader.cs : When ReadPattern() if no valid pattern appears
Modified: trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/RelaxngGrammar.cs
===================================================================
--- trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/RelaxngGrammar.cs 2005-07-31 \
12:06:38 UTC (rev 47873)
+++ trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/RelaxngGrammar.cs 2005-07-31 \
13:18:48 UTC (rev 47874) @@ -253,11 +253,13 @@
// 7.2
RdpContentType ct = startPattern.ContentType;
- // TODO: 7.3
-
// 4.19 (c) expandRef - actual replacement
startPattern = compiledStart.ExpandRef (assembledDefs);
+ // FIXME: support 7.3 (implemented but cannot verify it
+ // because of weird exception handling in the runtime)
+// startPattern.CheckAttributeDuplicates ();
+
// return its start pattern.
IsCompiled = true;
return startPattern;
Modified: trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/ChangeLog
===================================================================
--- trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/ChangeLog 2005-07-31 \
12:06:38 UTC (rev 47873)
+++ trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/ChangeLog 2005-07-31 \
13:18:48 UTC (rev 47874) @@ -1,3 +1,9 @@
+2005-07-31 Atsushi Enomoto <atsushi@ximian.com>
+
+ * RdpPattern.cs : GetLabels() for RdpGroup should check attributes
+ when the left branch is not nullable (it works like an interleave).
+ Implemented spec 7.3 attribute check (though not enabled for now).
+
2005-04-11 Atsushi Enomoto <atsushi@ximian.com>
* Util.cs : tiny debug string fix.
Modified: trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/RdpPatterns.cs
===================================================================
--- trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/RdpPatterns.cs 2005-07-31 \
12:06:38 UTC (rev 47873)
+++ trunk/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/RdpPatterns.cs 2005-07-31 \
13:18:48 UTC (rev 47874) @@ -203,6 +203,10 @@
internal abstract void CheckConstraints (bool attribute, bool oneOrMore, bool \
oneOrMoreGroup, bool oneOrMoreInterleave, bool list, bool dataExcept);
+ internal virtual void CheckAttributeDuplicates ()
+ {
+ }
+
internal abstract bool ContainsText ();
internal virtual RdpPattern ExpandRef (Hashtable defs)
@@ -222,6 +226,8 @@
internal void AddNameLabel (LabelList names, RdpNameClass nc)
{
+ if (names == null)
+ return;
RdpName name = nc as RdpName;
if (name != null) {
XmlQualifiedName qname = new XmlQualifiedName (
@@ -642,6 +648,32 @@
{
return l.ContainsText () || r.ContainsText ();
}
+
+ internal override void CheckAttributeDuplicates ()
+ {
+ LValue.CheckAttributeDuplicates ();
+ RValue.CheckAttributeDuplicates ();
+ }
+
+ // 7.3
+ internal void CheckAttributeDuplicatesCore ()
+ {
+ // expecting all items are interned
+ bool checkAttributes = false;
+ Hashtable lc = new Hashtable ();
+ LValue.GetLabels (null, lc);
+ if (lc.Count == 0)
+ return;
+
+ Hashtable rc = new Hashtable ();
+ RValue.GetLabels (null, rc);
+ if (rc.Count == 0)
+ return;
+
+ foreach (XmlQualifiedName name in lc.Values)
+ if (rc.Contains (name))
+ throw new RelaxngException ("Duplicate attributes inside a group or an \
interleave is not allowed."); + }
}
// Choice
@@ -876,6 +908,13 @@
if (LValue.PatternType == RelaxngPatternType.Text && RValue.PatternType == \
RelaxngPatternType.Text)
throw new RelaxngException ("Both branches of the interleave contains a text \
pattern."); }
+
+ // 7.3
+ internal override void CheckAttributeDuplicates ()
+ {
+ base.CheckAttributeDuplicates ();
+ CheckAttributeDuplicatesCore ();
+ }
}
// Group
@@ -901,6 +940,8 @@
LValue.GetLabels (elements, attributes);
if (LValue.Nullable)
RValue.GetLabels (elements, attributes);
+ else
+ RValue.GetLabels (null, attributes);
}
public override RdpPattern TextDeriv (string s, XmlReader reader)
@@ -957,6 +998,13 @@
LValue.CheckConstraints (attribute, oneOrMore, oneOrMore, oneOrMoreInterleave, \
list, dataExcept); RValue.CheckConstraints (attribute, oneOrMore, oneOrMore, \
oneOrMoreInterleave, list, dataExcept); }
+
+ // 7.3
+ internal override void CheckAttributeDuplicates ()
+ {
+ base.CheckAttributeDuplicates ();
+ CheckAttributeDuplicatesCore ();
+ }
}
public abstract class RdpAbstractSingleContent : RdpPattern
@@ -990,6 +1038,11 @@
{
return child.ContainsText ();
}
+
+ internal override void CheckAttributeDuplicates ()
+ {
+ child.CheckAttributeDuplicates ();
+ }
}
// OneOrMore
@@ -1085,7 +1138,6 @@
throw new RelaxngException ("oneOrMore is not allowed under except of a data.");
this.Child.CheckConstraints (attribute, true, oneOrMoreGroup, \
oneOrMoreInterleave, list, dataExcept); }
-
}
// List
@@ -1556,6 +1608,11 @@
{
return children.ContainsText ();
}
+
+ internal override void CheckAttributeDuplicates ()
+ {
+ children.CheckAttributeDuplicates ();
+ }
}
// After
_______________________________________________
Mono-patches maillist - Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic