XmlSchemaKeyref.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Author: Dwivedi, Ajay kumar
  2. // [email protected]
  3. using System;
  4. using System.Xml;
  5. using System.Xml.Serialization;
  6. namespace System.Xml.Schema
  7. {
  8. /// <summary>
  9. /// Summary description for XmlSchemaKeyref.
  10. /// </summary>
  11. public class XmlSchemaKeyref : XmlSchemaIdentityConstraint
  12. {
  13. private XmlQualifiedName refer;
  14. private int errorCount;
  15. public XmlSchemaKeyref()
  16. {
  17. refer = XmlQualifiedName.Empty;
  18. }
  19. [System.Xml.Serialization.XmlAttribute("refer")]
  20. public XmlQualifiedName Refer
  21. {
  22. get{ return refer; }
  23. set{ refer = value; }
  24. }
  25. /// <remarks>
  26. /// 1. name must be present
  27. /// 2. selector and field must be present
  28. /// 3. refer must be present
  29. /// </remarks>
  30. [MonoTODO]
  31. internal new int Compile(ValidationEventHandler h, XmlSchemaInfo info)
  32. {
  33. errorCount = base.Compile(h,info);
  34. if(refer == null || refer.IsEmpty)
  35. error(h,"refer must be present");
  36. return errorCount;
  37. }
  38. [MonoTODO]
  39. internal int Validate(ValidationEventHandler h)
  40. {
  41. return errorCount;
  42. }
  43. internal new void error(ValidationEventHandler handle, string message)
  44. {
  45. errorCount++;
  46. ValidationHandler.RaiseValidationError(handle, this, message);
  47. }
  48. }
  49. }