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>2005-07-31 17:18:48 +0400
committerAtsushi Eno <atsushieno@gmail.com>2005-07-31 17:18:48 +0400
commit5ec411553599e2027f417b1b9dd35a372b8018d8 (patch)
tree4e8f17d5b876b1ad834fe040c652d1c128d26560 /mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative
parent4c446233e666115c14dd1c3eab7bfbb9e319b11c (diff)
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. svn path=/trunk/mcs/; revision=47874
Diffstat (limited to 'mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative')
-rw-r--r--mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/ChangeLog6
-rw-r--r--mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/RdpPatterns.cs59
2 files changed, 64 insertions, 1 deletions
diff --git a/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/ChangeLog b/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/ChangeLog
index c5a36fbf704..d35181a32fe 100644
--- a/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/ChangeLog
+++ b/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/ChangeLog
@@ -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.
diff --git a/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/RdpPatterns.cs b/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/RdpPatterns.cs
index 21461197b56..fc0c372dc0e 100644
--- a/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/RdpPatterns.cs
+++ b/mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng.Derivative/RdpPatterns.cs
@@ -203,6 +203,10 @@ namespace Commons.Xml.Relaxng.Derivative
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 @@ namespace Commons.Xml.Relaxng.Derivative
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 @@ namespace Commons.Xml.Relaxng.Derivative
{
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 @@ namespace Commons.Xml.Relaxng.Derivative
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 @@ namespace Commons.Xml.Relaxng.Derivative
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 @@ namespace Commons.Xml.Relaxng.Derivative
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 @@ namespace Commons.Xml.Relaxng.Derivative
{
return child.ContainsText ();
}
+
+ internal override void CheckAttributeDuplicates ()
+ {
+ child.CheckAttributeDuplicates ();
+ }
}
// OneOrMore
@@ -1085,7 +1138,6 @@ namespace Commons.Xml.Relaxng.Derivative
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 @@ namespace Commons.Xml.Relaxng.Derivative
{
return children.ContainsText ();
}
+
+ internal override void CheckAttributeDuplicates ()
+ {
+ children.CheckAttributeDuplicates ();
+ }
}
// After