00001 00002 /* 00003 | Author: Michael Schmidt; 00004 | Gunnar Jehl 00005 | 00006 | ************************* SOFTWARE LICENSE AGREEMENT *********************** 00007 | This source code is published under the BSD License. 00008 | 00009 | See file 'LICENSE.txt' that comes with this distribution or 00010 | http://dbis.informatik.uni-freiburg.de/index.php?project=GCX/license.php 00011 | for the full license agreement. 00012 | 00013 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00014 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00015 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00016 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00017 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00018 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00019 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00020 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00021 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00022 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00023 | POSSIBILITY OF SUCH DAMAGE. 00024 | **************************************************************************** 00025 */ 00026 00035 #include "streampreprocessor.h" 00036 00037 StreamPreProcessor *StreamPreProcessor::instance = NULL; 00038 00039 void StreamPreProcessor::initInstance(Buffer * _buffer, ProjectionDFA * _pdfa) { 00040 instance = new StreamPreProcessor(_buffer, _pdfa); 00041 } 00042 00043 StreamPreProcessor *StreamPreProcessor::getInstance() { 00044 return instance; 00045 } 00046 00047 StreamPreProcessor::StreamPreProcessor(Buffer * _buffer, ProjectionDFA * _pdfa): 00048 tagmap(TagMap::getInstance()), st(_pdfa, _buffer) { 00049 InputStream *xml_istream = 00050 StreamManager::getInstance()->getXMLInputStream(); 00051 yyxmlin = xml_istream->getParserStream(); 00052 } 00053 00054 StreamPreProcessor::~StreamPreProcessor() { 00055 destroyLexer(); 00056 } 00057 00058 void StreamPreProcessor::readNext() { 00059 if (!saxparse()) { 00060 #ifdef VALIDATION 00061 st.processClosingTag((TAG) TAGID_ROOT); // close the root 00062 #else 00063 st.processClosingTag(); // close the root 00064 #endif // #ifdef VALIDATION 00065 } 00066 } 00067 00068 void StreamPreProcessor::readAll() { 00069 while (saxparse()) { 00070 } 00071 00072 #ifdef VALIDATION 00073 st.processClosingTag((TAG) TAGID_ROOT); // close the root 00074 #else 00075 st.processClosingTag(); // close the root 00076 #endif // #ifdef VALIDATION 00077 }