xmlj_io.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /* xmlj_io.h -
  2. Copyright (C) 2003, 2004 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. #ifndef XMLJ_IO_H
  32. #define XMLJ_IO_H
  33. #include <jni.h>
  34. #include <libxml/xmlIO.h>
  35. #include "xmlj_error.h"
  36. typedef struct _SAXParseContext
  37. {
  38. JNIEnv *env; /* Current JNI environment */
  39. jobject obj; /* The gnu.xml.libxmlj.sax.GnomeXmlReader instance */
  40. xmlParserCtxtPtr ctx; /* libxml2 parser context */
  41. xmlSAXLocatorPtr loc; /* libxml2 SAX locator */
  42. xmlSAXHandlerPtr sax; /* pristine SAX handler */
  43. jstring publicId;
  44. jstring systemId;
  45. jmethodID startDTD;
  46. jmethodID externalEntityDecl;
  47. jmethodID internalEntityDecl;
  48. jmethodID resolveEntity;
  49. jmethodID notationDecl;
  50. jmethodID attributeDecl;
  51. jmethodID elementDecl;
  52. jmethodID unparsedEntityDecl;
  53. jmethodID setDocumentLocator;
  54. jmethodID startDocument;
  55. jmethodID endDocument;
  56. jmethodID startElement;
  57. jmethodID endElement;
  58. jmethodID characters;
  59. jmethodID ignorableWhitespace;
  60. jmethodID processingInstruction;
  61. jmethodID comment;
  62. jmethodID cdataBlock;
  63. jmethodID warning;
  64. jmethodID error;
  65. jmethodID fatalError;
  66. jmethodID resolveURIAndOpen; /* JavaProxy */
  67. jclass stringClass;
  68. }
  69. SAXParseContext;
  70. SAXParseContext *
  71. xmljNewSAXParseContext (JNIEnv * env, jobject obj, xmlParserCtxtPtr ctx,
  72. jstring publicId, jstring systemId);
  73. void
  74. xmljFreeSAXParseContext (SAXParseContext * saxCtx);
  75. xmlParserCtxtPtr
  76. xmljNewParserContext (JNIEnv * env,
  77. jobject inputStream,
  78. jbyteArray detectBuffer,
  79. jstring publicId,
  80. jstring systemId,
  81. jstring base,
  82. jboolean validate,
  83. jboolean coalesce,
  84. jboolean expandEntities,
  85. jboolean loadEntities);
  86. void
  87. xmljFreeParserContext (xmlParserCtxtPtr parserContext);
  88. xmlDocPtr
  89. xmljParseDocument (JNIEnv * env,
  90. jobject self,
  91. jobject in,
  92. jbyteArray detectBuffer,
  93. jstring publicId,
  94. jstring systemId,
  95. jstring base,
  96. jboolean validate,
  97. jboolean coalesce,
  98. jboolean expandEntities,
  99. jboolean contentHandler,
  100. jboolean dtdHandler,
  101. jboolean entityResolver,
  102. jboolean errorHandler,
  103. jboolean declarationHandler,
  104. jboolean lexicalHandler,
  105. int saxMode);
  106. xmlDocPtr
  107. xmljParseDocument2 (JNIEnv * env,
  108. xmlParserCtxtPtr ctx,
  109. SAXParseContext *saxCtx,
  110. xmlSAXHandlerPtr sax,
  111. int saxMode);
  112. xmlParserInputPtr
  113. xmljNewParserInput (JNIEnv * env,
  114. jobject inputStream,
  115. jbyteArray detectBuffer,
  116. xmlParserCtxtPtr parserContext);
  117. xmlParserInputBufferPtr
  118. xmljNewParserInputBuffer (JNIEnv * env,
  119. jobject inputStream,
  120. xmlCharEncoding encoding);
  121. void
  122. xmljSaveFileToJavaOutputStream (JNIEnv * env, jobject outputStream,
  123. xmlDocPtr tree,
  124. const char *outputEncoding);
  125. /*
  126. xmlParserInputPtr
  127. xmljLoadExternalEntity (const char *URL, const char *ID,
  128. xmlParserCtxtPtr ctxt);
  129. jobject
  130. xmljResolveURI (SaxErrorContext * saxErrorContext, const char *URL,
  131. const char *ID);
  132. */
  133. xmlDocPtr
  134. xmljResolveURIAndOpen (SAXParseContext *saxContext,
  135. const char *URL, const char *ID);
  136. void
  137. xmljSetThreadContext (SAXParseContext * ctxt);
  138. SAXParseContext *
  139. xmljGetThreadContext (void);
  140. void
  141. xmljClearThreadContext (void);
  142. #endif /* !defined XMLJ_IO_H */