Subversion Repositories Kolibri OS

Rev

Rev 5499 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #ifndef INCLUDE_LIBXML_H
  2. #define INCLUDE_LIBXML_H
  3.  
  4. #ifndef INCLUDE_KOLIBRI_H
  5. #include "../lib/kolibri.h"
  6. #endif
  7.  
  8. #ifndef INCLUDE_DLL_H
  9. #include "../lib/dll.h"
  10. #endif
  11. dword XML = #aXML_lib;
  12. char aXML_lib[]               = "/sys/lib/xml.obj";
  13.  
  14. dword XML_lib_init            = #aXMLlib_init;
  15.  
  16. dword initializeParser        = #aInitializeParser;
  17. dword releaseParser           = #aReleaseParser;
  18. dword parse                   = #aParse;
  19. dword initializeClassParser   = #aInitializeClassParser;
  20. dword releaseCkassParser      = #aReleaseClassParser;
  21. dword classFromElement        = #aClassFromElement;
  22. dword classFromString         = #aClassFromString;
  23.  
  24. $DD 2 dup 0
  25.  
  26. char aXMLlib_init []          = "lib_init";
  27. char aInitializeParser[]      = "ax_initializeParser";
  28. char aReleaseParser[]         = "ax_releaseParser";
  29. char aParse[]                 = "ax_parse";
  30. char aInitializeClassParser[] = "ax_initializeClassParser";
  31. char aReleaseClassParser[]    = "ax_releaseClassParser";
  32. char aClassFromElement[]      = "ax_classFromElement";
  33. char aClassFromString[]       = "ax_classFromString";
  34.  
  35. //-----------------------------------------------------------------------------
  36. // Error Codes
  37. //-----------------------------------------------------------------------------
  38. #define RC_OK                           0 // everything is ok
  39. #define RC_MEMORY                       1 // out of memory
  40.  
  41. #define RC_EMPTY_NAME                  10 // name empty or not defined
  42. #define RC_ATTR_DEFINED                11 // attribute already defined
  43. #define RC_ELEM_DEFINED                12 // element already defined
  44. #define RC_SCHEMA_EMPTY                13 // schema does not contains a document
  45. #define RC_DOCUMENT_DEFINED            14 // schema contains more than one document
  46. #define RC_UNDEFINED_CLASS             15 // can't find collection in reference
  47. #define RC_UNDEFINED_GROUP             16 // can't find a group in include
  48. #define RC_INVALID_ID                  17 // id is not a valid number
  49. #define RC_INVALID_IGNORE              18 // ignore is not 'yes' or 'no'
  50.  
  51. #define RC_INVALID_ENTITY_REFERENCE    20 // must be amp, quot, lt, gt, or apos
  52. #define RC_UNEXPECTED_END              21 // found last char too early
  53. #define RC_INVALID_CHAR                22 // wrong char
  54. #define RC_OVERFLOW                    23 // number to big in char reference
  55. #define RC_NO_START_TAG                24 // xml does not start with a tag
  56. #define RC_TAG_MISMATCH                25 // invalid close tag
  57. #define RC_INVALID_TAG                 26 // invalid root element
  58. #define RC_INVALID_ATTRIBUTE           27 // unknown attribute
  59. #define RC_INVALID_PI                  28 // invalid processing instruction (<?xml)
  60. #define RC_INVALID_DOCTYPE             29 // duplicate doctype or after main element
  61. #define RC_VERSION_EXPECTED            30 // version is missing in xml declaration
  62.  
  63. //-----------------------------------------------------------------------------
  64. // Structures
  65. //-----------------------------------------------------------------------------
  66.  
  67. struct AXElementClass
  68. {
  69.   dword offset;                 // (int)              Offset of the element in attribute list
  70.   dword name;                   // (char*)            Name of the element (not zero terminated)
  71.   dword nameLimit;              // (char*)            End of the name of the element
  72.   dword size;                   // (unsigned int)     size in bytes of an element of this class
  73.   dword id;                     // (unsigned int)     container, text or mixed
  74.   dword type;                   // (unsigned int)     container, text or mixed
  75.   dword propertyCount;          // (unsigned int)     number of attributes and text elements
  76.   dword childCount;             // (unsigned int)     number of child classes
  77.   dword attributes;             // (int*)             (internal) attribute map
  78.   dword elements;               // (int*)             (internal) element map
  79.   dword children;               // (AXElementClass*)  The list of child classes.
  80.                                 // The order is the one defined in the class
  81.                                 // definition file.
  82.   dword reserved;               // (int)
  83.   dword reserved2;              // (void*)
  84. };
  85.  
  86. struct AXClassContext
  87. {
  88.   dword base;                   // (void*)
  89.   dword limit;                  // (void*)
  90.   dword chunks;                 // (void*)
  91.   dword chunkSize;              // (int)
  92.   dword errorCode;              // (int)
  93.   dword line;                   // (int)
  94.   dword column;                 // (int)
  95.   dword classes;                // (AXElementClass**) all global classes
  96.   dword rootClass;              // (AXElementClass*)  the root class
  97.   dword rootElement;            // (AXElement*)
  98. };
  99.  
  100. struct AXAttribute
  101. {
  102.   dword begin;                   // (const char*)      the value (not zero terminated)
  103.                                  // This slot can also contain an element if
  104.                                  // a <element> has been defined in schema;
  105.                                  // use ax_getElement() to retrieve it.
  106.   dword limit;                   // (const char*)      the end of the value
  107. };
  108.  
  109. struct AXElement
  110. {
  111.   dword id;                       // (int)              the class of the element
  112.   dword nextSibling;              // (AXElement*)       the next sibling element
  113.   dword firstChild;               // (AXElement*)       the first child element
  114.   dword lastChild;                // (AXElement*)       the last child element
  115.   AXAttribute reserved;           // (AXAttribute)      do not use
  116.   AXAttribute attributes;         // (AXAttribute[])    the array of attributes
  117. };
  118.  
  119. struct AXParseContext
  120. {
  121.   dword base;                   // (void*)
  122.   dword limit;                  // (void*)
  123.   dword chunks;                 // (void*)
  124.   dword chunkSize;              // (int)
  125.   dword errorCode;              // (int)
  126.   dword source;                 // (const char*)
  127.   dword current;                // (const char*)
  128.   dword line;                   // (int)
  129.   dword column;                 // (int)
  130.   dword root;                   // (AXElement*)
  131.   AXAttribute version;          // (AXAttribute)
  132.   AXAttribute encoding;         // (AXAttribute)
  133.   dword strict;                 // (int)
  134.   dword reserved1;              // (int)
  135.   AXElement reserved2;          // (AXElement)
  136. };
  137.  
  138. #endif