home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / xml / expat / xmlparse / xmlparse.h < prev   
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.7 KB  |  132 lines

  1. /*
  2. The contents of this file are subject to the Mozilla Public License
  3. Version 1.0 (the "License"); you may not use this file except in
  4. compliance with the License. You may obtain a copy of the License at
  5. http://www.mozilla.org/MPL/
  6.  
  7. Software distributed under the License is distributed on an "AS IS"
  8. basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  9. License for the specific language governing rights and limitations
  10. under the License.
  11.  
  12. The Original Code is expat.
  13.  
  14. The Initial Developer of the Original Code is James Clark.
  15. Portions created by James Clark are Copyright (C) 1998
  16. James Clark. All Rights Reserved.
  17.  
  18. Contributor(s):
  19. */
  20.  
  21. #ifndef XmlParse_INCLUDED
  22. #define XmlParse_INCLUDED 1
  23.  
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27.  
  28. #ifndef XMLPARSEAPI
  29. #define XMLPARSEAPI /* as nothing */
  30. #endif
  31.  
  32. typedef void *XML_Parser;
  33.  
  34. /* Constructs a new parser; encoding should be the name of the charset from
  35. the Content-Type header if the Content-Type is text/xml, or null otherwise. */
  36.  
  37. XML_Parser XMLPARSEAPI
  38. XML_ParserCreate(const char *encoding);
  39.  
  40. /* Information is UTF-8 encoded. */
  41.  
  42. /* atts is array of name/value pairs, terminated by NULL;
  43.    names and values are '\0' terminated. */
  44.  
  45. typedef void (*XML_StartElementHandler)(void *userData,
  46.                     const char *name,
  47.                     const char **atts);
  48.  
  49. typedef void (*XML_EndElementHandler)(void *userData,
  50.                       const char *name);
  51.  
  52. typedef void (*XML_CharacterDataHandler)(void *userData,
  53.                      const char *s,
  54.                      int len);
  55.  
  56. /* target and data are '\0' terminated */
  57. typedef void (*XML_ProcessingInstructionHandler)(void *userData,
  58.                          const char *target,
  59.                          const char *data);
  60.  
  61. void XMLPARSEAPI
  62. XML_SetElementHandler(XML_Parser parser,
  63.               XML_StartElementHandler start,
  64.               XML_EndElementHandler end);
  65.  
  66. void XMLPARSEAPI
  67. XML_SetCharacterDataHandler(XML_Parser parser,
  68.                 XML_CharacterDataHandler handler);
  69.  
  70. void XMLPARSEAPI
  71. XML_SetProcessingInstructionHandler(XML_Parser parser,
  72.                     XML_ProcessingInstructionHandler handler);
  73.  
  74. /* This value is passed as the userData argument to callbacks. */
  75. void XMLPARSEAPI
  76. XML_SetUserData(XML_Parser parser, void *userData);
  77.  
  78. /* Parses some input. Returns 0 if a fatal error is detected.
  79. The last call to XML_Parse must have isFinal true;
  80. len may be zero for this call (or any other). */
  81. int XMLPARSEAPI
  82. XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
  83.  
  84. void XMLPARSEAPI *
  85. XML_GetBuffer(XML_Parser parser, int len);
  86.  
  87. int XMLPARSEAPI
  88. XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
  89.  
  90. /* If XML_Parser or XML_ParseEnd have returned 0, then XML_GetError*
  91. returns information about the error. */
  92.  
  93. enum XML_Error {
  94.   XML_ERROR_NONE,
  95.   XML_ERROR_NO_MEMORY,
  96.   XML_ERROR_SYNTAX,
  97.   XML_ERROR_NO_ELEMENTS,
  98.   XML_ERROR_INVALID_TOKEN,
  99.   XML_ERROR_UNCLOSED_TOKEN,
  100.   XML_ERROR_PARTIAL_CHAR,
  101.   XML_ERROR_TAG_MISMATCH,
  102.   XML_ERROR_DUPLICATE_ATTRIBUTE,
  103.   XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
  104.   XML_ERROR_PARAM_ENTITY_REF,
  105.   XML_ERROR_UNDEFINED_ENTITY,
  106.   XML_ERROR_RECURSIVE_ENTITY_REF,
  107.   XML_ERROR_ASYNC_ENTITY,
  108.   XML_ERROR_BAD_CHAR_REF,
  109.   XML_ERROR_BINARY_ENTITY_REF,
  110.   XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
  111.   XML_ERROR_MISPLACED_XML_PI,
  112.   XML_ERROR_UNKNOWN_ENCODING,
  113.   XML_ERROR_INCORRECT_ENCODING
  114. };
  115.  
  116. int XMLPARSEAPI XML_GetErrorCode(XML_Parser parser);
  117. int XMLPARSEAPI XML_GetErrorLineNumber(XML_Parser parser);
  118. int XMLPARSEAPI XML_GetErrorColumnNumber(XML_Parser parser);
  119. long XMLPARSEAPI XML_GetErrorByteIndex(XML_Parser parser);
  120.  
  121. void XMLPARSEAPI
  122. XML_ParserFree(XML_Parser parser);
  123.  
  124. const char XMLPARSEAPI *
  125. XML_ErrorString(int code);
  126.  
  127. #ifdef __cplusplus
  128. }
  129. #endif
  130.  
  131. #endif /* not XmlParse_INCLUDED */
  132.