XmlSchemaAttributeGroupRef.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 XmlSchemaAttributeGroupRef.
  10. /// </summary>
  11. public class XmlSchemaAttributeGroupRef : XmlSchemaAnnotated
  12. {
  13. private XmlQualifiedName refName;
  14. private int errorCount;
  15. public XmlSchemaAttributeGroupRef()
  16. {
  17. refName = XmlQualifiedName.Empty;
  18. }
  19. [System.Xml.Serialization.XmlAttribute("ref")]
  20. public XmlQualifiedName RefName
  21. {
  22. get{ return refName; }
  23. set{ refName = value; }
  24. }
  25. /// <remarks>
  26. /// 1. ref must be present
  27. /// 2. The element must be empty. FIXME: does it mean no id attribute too??
  28. /// </remarks>
  29. [MonoTODO]
  30. internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
  31. {
  32. errorCount = 0;
  33. if(this.refName == null || this.refName.IsEmpty)
  34. error(h, "ref must be present");
  35. if(this.Id != null && !XmlSchemaUtil.CheckID(Id))
  36. error(h, "id must be a valid ID");
  37. if(this.Annotation != null)
  38. error(h, "attributegroup with a ref can't have any content");
  39. return errorCount;
  40. }
  41. [MonoTODO]
  42. internal int Validate(ValidationEventHandler h)
  43. {
  44. return errorCount;
  45. }
  46. internal void error(ValidationEventHandler handle,string message)
  47. {
  48. this.errorCount++;
  49. ValidationHandler.RaiseValidationError(handle,this,message);
  50. }
  51. }
  52. }