// information to validate attribute values.
internal XmlSchemaDatatype CurrentAttributeType;
+ XmlSchemaInfo current_info;
+
#endregion
#region Public properties
throw new ArgumentNullException ("localName");
if (ns == null)
throw new ArgumentNullException ("ns");
+ SetCurrentInfo (info);
+ try {
CheckState (Transition.Content);
transition = Transition.StartTag;
info.MemberType = null;
// FIXME: supply Validity (really useful?)
}
+
+ } finally {
+ current_info = null;
+ }
}
public object ValidateEndElement (XmlSchemaInfo info)
public object ValidateEndElement (XmlSchemaInfo info,
object var)
{
+ SetCurrentInfo (info);
+ try {
+
// If it is going to validate an empty element, then
// first validate end of attributes.
- if (transition == Transition.StartTag)
+ if (transition == Transition.StartTag) {
+ current_info = null;
ValidateEndOfAttributes (info);
+ }
CheckState (Transition.Content);
else if (skipValidationDepth < 0 || depth <= skipValidationDepth)
ret = AssessEndElementSchemaValidity (info);
return ret;
+
+ } finally {
+ current_info = null;
+ }
}
// StartTagCloseDeriv
public void ValidateEndOfAttributes (XmlSchemaInfo info)
{
try {
+ SetCurrentInfo (info);
+
CheckState (Transition.StartTag);
transition = Transition.Content;
if (schemas.Count == 0)
AssessCloseStartElementSchemaValidity (info);
depth++;
} finally {
+ current_info = null;
occuredAtts.Clear ();
}
}
private void HandleError (ValException exception, bool isWarning)
{
+ if (current_info != null)
+ current_info.Validity = XmlSchemaValidity.Invalid;
+
if (isWarning && IgnoreWarnings)
return;
#endregion
+ // call this at entry point of every public method.
+ private void SetCurrentInfo (XmlSchemaInfo info)
+ {
+ if (current_info != null)
+ throw new InvalidOperationException ("Not allowed concurrent call to validation method");
+ current_info = info;
+ if (info != null)
+ current_info.Validity = XmlSchemaValidity.Valid;
+ }
+
private void CheckState (Transition expected)
{
if (transition != expected) {