XsdDataContractImporter.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. using System.CodeDom;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Xml;
  6. using System.Xml.Schema;
  7. using QName = System.Xml.XmlQualifiedName;
  8. namespace System.Runtime.Serialization
  9. {
  10. public class XsdDataContractImporter
  11. {
  12. ImportOptions options;
  13. CodeCompileUnit ccu;
  14. public XsdDataContractImporter ()
  15. {
  16. }
  17. public XsdDataContractImporter (CodeCompileUnit ccu)
  18. {
  19. this.ccu = ccu;
  20. }
  21. public CodeCompileUnit CodeCompileUnit {
  22. get { return ccu; }
  23. }
  24. public ImportOptions Options {
  25. get { return options; }
  26. set { options = value; }
  27. }
  28. public CodeTypeReference GetCodeTypeReference (QName typeName)
  29. {
  30. throw new NotImplementedException ();
  31. }
  32. public bool CanImport (XmlSchemaSet schemas)
  33. {
  34. foreach (XmlSchemaElement e in schemas.GlobalElements)
  35. if (!CanImport (schemas, e))
  36. return false;
  37. return true;
  38. }
  39. public bool CanImport (XmlSchemaSet schemas,
  40. IList<QName> typeNames)
  41. {
  42. foreach (QName name in typeNames)
  43. if (!CanImport (schemas, name))
  44. return false;
  45. return true;
  46. }
  47. public bool CanImport (XmlSchemaSet schemas, QName name)
  48. {
  49. return CanImport (schemas,
  50. (XmlSchemaElement) schemas.GlobalElements [name]);
  51. }
  52. public bool CanImport (XmlSchemaSet schemas, XmlSchemaElement element)
  53. {
  54. throw new NotImplementedException ();
  55. }
  56. public void Import (XmlSchemaSet schemas)
  57. {
  58. foreach (XmlSchemaElement e in schemas.GlobalElements)
  59. Import (schemas, e);
  60. }
  61. public void Import (XmlSchemaSet schemas,
  62. IList<QName> typeNames)
  63. {
  64. foreach (QName name in typeNames)
  65. Import (schemas, name);
  66. }
  67. public void Import (XmlSchemaSet schemas, QName name)
  68. {
  69. Import (schemas,
  70. (XmlSchemaElement) schemas.GlobalElements [name]);
  71. }
  72. public QName Import (XmlSchemaSet schemas, XmlSchemaElement element)
  73. {
  74. throw new NotImplementedException ();
  75. }
  76. }
  77. }