- private void AssessEachAttributeIdentityConstraint (XmlSchemaDatatype dt,
- string normalized, object parsedValue)
- {
- // Get normalized value and (if required) parsedValue if missing.
- switch (dt.TokenizedType) {
- case XmlTokenizedType.IDREFS:
- if (normalized == null)
- normalized = dt.Normalize (reader.Value);
- if (parsedValue == null)
- parsedValue = dt.ParseValue (normalized, reader.NameTable, ParserContext.NamespaceManager);
- break;
- case XmlTokenizedType.ID:
- case XmlTokenizedType.IDREF:
- if (normalized == null)
- normalized = dt.Normalize (reader.Value);
- break;
- }
-
- // Validate identity constraints.
- switch (dt.TokenizedType) {
- case XmlTokenizedType.ID:
- if (thisElementId != null)
- HandleError ("ID type attribute was already assigned in the containing element.");
- thisElementId = normalized;
- if (idList.Contains (normalized))
- HandleError ("Duplicate ID value was found.");
- else
- idList.Add (normalized, normalized);
- break;
- case XmlTokenizedType.IDREF:
- if (missingIDReferences.Contains (normalized))
- missingIDReferences.Remove (normalized);
- else
- missingIDReferences.Add (normalized);
- break;
- case XmlTokenizedType.IDREFS:
- foreach (string id in (string []) parsedValue) {
- if (missingIDReferences.Contains (id))
- missingIDReferences.Remove (id);
- else
- missingIDReferences.Add (id);
+ if (attr.ValidatedFixedValue != null &&
+ attr.ValidatedFixedValue != normalized) {
+ HandleError ("The value of the attribute " + attr.QualifiedName + " does not match with its fixed value.");
+ parsedValue = dt.ParseValue (attr.ValidatedFixedValue, reader.NameTable, NamespaceManager);