/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ #include #include #include #include #if (_MSC_VER >=1400) #pragma warning(disable:4365) #endif #ifdef UNX #define strnicmp strncasecmp #endif // NOT FULLY DEFINED SERVICES #define AssertionOf(x) \ {if (!(x)) {std::cerr << "Assertion failed: " << #x << __FILE__ << __LINE__ << std::endl; exit(3); }} X2CParser::X2CParser( XmlElement & o_rDocumentData ) : // sFileName, nFileLine(0), pDocumentData(&o_rDocumentData), // sWord, text(0) { } X2CParser::~X2CParser() { } bool X2CParser::LoadFile( const char * i_sFilename ) { sFileName = i_sFilename; nFileLine = 1; // Load file: if ( ! LoadXmlFile( aFile, i_sFilename ) ) return false; // Test correct end: const char * pLastTag = strrchr(aFile.operator const char *(),'<'); if (pLastTag == 0) return false; if ( strnicmp(pLastTag+2, pDocumentData->Name().str(), pDocumentData->Name().l()) != 0 || strnicmp(pLastTag, "') == 0) return false; return true; } void X2CParser::Parse() { // Parse: text = aFile.operator const char *(); Parse_XmlDeclaration(); Parse_Doctype(); // skip XML comment Goto('<'); if ( IsText("