xmlschema.c.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. xmlschema.c
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='xmlscan.c.html' title=' xmlscan.c '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='xmlselect.c.html' title=' xmlselect.c '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * void xmlschema ();
  24. *
  25. * node.h
  26. *
  27. * print an XML schema on stdout that is compatible with function
  28. * xmledit; the schema should be used to validate files before any
  29. * attempt is make to parse them;
  30. *
  31. * Motley Tools by Charles Maier &lt;cmaier@cmassoc.net&gt;;
  32. * Copyright (c) 2001-2006 by Charles Maier Associates;
  33. * Licensed under the Internet Software Consortium License;
  34. *
  35. *--------------------------------------------------------------------*/
  36. #ifndef XMLSCHEMA_SOURCE
  37. #define XMLSCHEMA_SOURCE
  38. #include &quot;../nodes/node.h&quot;
  39. #include &quot;../tools/format.h&quot;
  40. void xmlschema ()
  41. {
  42. unsigned margin = 0;
  43. output (margin, &quot;&lt;?xml version='%s' encoding='%s'?&gt;&quot;, XML_VERSION, XML_CHARSET);
  44. output (margin++, &quot;&lt;xs:schema xmlns:xs='%s' elementFormDefault='%s'&gt;&quot;, XML_SCHEMA, &quot;qualified&quot;);
  45. output (margin++, &quot;&lt;xs:element name='%s'&gt;&quot;, DATA_OBJECT);
  46. output (margin++, &quot;&lt;xs:complexType&gt;&quot;);
  47. #if 0
  48. output (margin, &quot;&lt;xs:attribute name='%s' use='optional' type='xs:NCName'/&gt;&quot;, DATA_NAME);
  49. output (margin, &quot;&lt;xs:attribute name='%s' use='optional' type='xs:string'/&gt;&quot;, DATA_TEXT);
  50. #endif
  51. output (margin++, &quot;&lt;xs:sequence&gt;&quot;);
  52. output (margin, &quot;&lt;xs:element maxOccurs='unbounded' ref='%s'/&gt;&quot;, DATA_MEMBER);
  53. output (margin--, &quot;&lt;/xs:sequence&gt;&quot;);
  54. output (margin--, &quot;&lt;/xs:complexType&gt;&quot;);
  55. output (margin--, &quot;&lt;/xs:element&gt;&quot;);
  56. output (margin++, &quot;&lt;xs:element name='%s'&gt;&quot;, DATA_MEMBER);
  57. output (margin++, &quot;&lt;xs:complexType&gt;&quot;);
  58. output (margin, &quot;&lt;xs:attribute name='%s' use='required' type='xs:NCName'/&gt;&quot;, DATA_NAME);
  59. #if 0
  60. output (margin, &quot;&lt;xs:attribute name='%s' use='optional' type='xs:string'/&gt;&quot;, DATA_TEXT);
  61. #endif
  62. output (margin++, &quot;&lt;xs:sequence&gt;&quot;);
  63. output (margin++, &quot;&lt;xs:sequence&gt;&quot;);
  64. output (margin, &quot;&lt;xs:element ref='%s'/&gt;&quot;, DATA_OFFSET);
  65. output (margin, &quot;&lt;xs:element ref='%s'/&gt;&quot;, DATA_LENGTH);
  66. output (margin--, &quot;&lt;/xs:sequence&gt;&quot;);
  67. output (margin++, &quot;&lt;xs:choice&gt;&quot;);
  68. output (margin, &quot;&lt;xs:element ref='%s'/&gt;&quot;, DATA_STRUCT);
  69. output (margin, &quot;&lt;xs:element ref='%s'/&gt;&quot;, DATA_STRING);
  70. output (margin, &quot;&lt;xs:element ref='%s'/&gt;&quot;, DATA_HUGE);
  71. output (margin, &quot;&lt;xs:element ref='%s'/&gt;&quot;, DATA_LONG);
  72. output (margin, &quot;&lt;xs:element ref='%s'/&gt;&quot;, DATA_WORD);
  73. output (margin, &quot;&lt;xs:element ref='%s'/&gt;&quot;, DATA_BYTE);
  74. output (margin--, &quot;&lt;/xs:choice&gt;&quot;);
  75. output (margin--, &quot;&lt;/xs:sequence&gt;&quot;);
  76. output (margin--, &quot;&lt;/xs:complexType&gt;&quot;);
  77. output (margin--, &quot;&lt;/xs:element&gt;&quot;);
  78. output (margin, &quot;&lt;xs:element name='%s' type='xs:positiveInteger'/&gt;&quot;, DATA_LENGTH);
  79. output (margin, &quot;&lt;xs:element name='%s' type='xs:hexBinary'/&gt;&quot;, DATA_OFFSET);
  80. output (margin++, &quot;&lt;xs:element name='%s'&gt;&quot;, DATA_STRUCT);
  81. output (margin++, &quot;&lt;xs:complexType&gt;&quot;);
  82. #if 0
  83. output (margin, &quot;&lt;xs:attribute name='%s' use='optional' type='xs:NCName'/&gt;&quot;, DATA_NAME);
  84. output (margin, &quot;&lt;xs:attribute name='%s' use='optional' type='xs:string'/&gt;&quot;, DATA_TEXT);
  85. #endif
  86. output (margin++, &quot;&lt;xs:choice maxOccurs='unbounded'&gt;&quot;);
  87. output (margin, &quot;&lt;xs:element ref='%s'/&gt;&quot;, DATA_BYTE);
  88. output (margin, &quot;&lt;xs:element ref='%s'/&gt;&quot;, DATA_MEMORY);
  89. output (margin--, &quot;&lt;/xs:choice&gt;&quot;);
  90. output (margin--, &quot;&lt;/xs:complexType&gt;&quot;);
  91. output (margin--, &quot;&lt;/xs:element&gt;&quot;);
  92. output (margin, &quot;&lt;xs:element name='%s' type='xs:string'/&gt;&quot;, DATA_STRING);
  93. output (margin, &quot;&lt;xs:element name='%s' type='xs:hexBinary'/&gt;&quot;, DATA_MEMORY);
  94. output (margin, &quot;&lt;xs:element name='%s' type='xs:unsignedLong'/&gt;&quot;, DATA_HUGE);
  95. output (margin, &quot;&lt;xs:element name='%s' type='xs:unsignedInt'/&gt;&quot;, DATA_LONG);
  96. output (margin, &quot;&lt;xs:element name='%s' type='xs:unsignedShort'/&gt;&quot;, DATA_WORD);
  97. output (margin, &quot;&lt;xs:element name='%s' type='xs:unsignedByte'/&gt;&quot;, DATA_BYTE);
  98. output (margin--, &quot;&lt;/xs:schema&gt;&quot;);
  99. return;
  100. }
  101. #endif
  102. </pre>
  103. <div class='footerlink'>
  104. [<a href='xmlscan.c.html' title=' xmlscan.c '>PREV</a>]
  105. [<a href='toolkit.html' title=' Index '>HOME</a>]
  106. [<a href='xmlselect.c.html' title=' xmlselect.c '>NEXT</a>]
  107. </div>
  108. </body>
  109. </html>