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