Beispiel #1
0
/*==============================================================================
 * FUNCTION:        RTLInstDict::readSSLFile
 * OVERVIEW:        Read and parse the SSL file, and initialise the expanded instruction dictionary (this object).
 *                  This also reads and sets up the register map and flag functions.
 * PARAMETERS:      SSLFileName - the name of the file containing the SSL specification.
 * RETURNS:         the file was successfully read
 *============================================================================*/
bool RTLInstDict::readSSLFile(const std::string &SSLFileName)
{
    // emptying the rtl dictionary
    idict.erase(idict.begin(), idict.end());
    // Clear all state
    reset();

    // Attempt to Parse the SSL file
#ifdef DEBUG_SSLPARSER
    SSLParser theParser(SSLFileName, true);
#else
    SSLParser theParser(SSLFileName, false);
#endif

    if (theParser.theScanner == NULL)
        return false;
    addRegister("%CTI", -1, 1, false);
    addRegister("%NEXT", -1, 32, false);

    theParser.yyparse(*this);

    fixupParams();

    if (Boomerang::get()->debugDecoder) {
        std::cout << "\n=======Expanded RTL template dictionary=======\n";
        print();
        std::cout << "\n==============================================\n\n";
    }

    return true;
}
void TestBasicRTFParser::ReadTokens()
{
	ComparisonContext cContext;
	RTFFileContext context;
	RTFParser theParser(&context);	
	CTestOnlyRTFInputFile TheTest("\\li1440\\ri720\\sl360\\slmult1\\nowidctlpar\\tqr\\tldot\\tx9360\\hyphpar0");
	theParser.SetFile(&TheTest);
	ERTFToken thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_li);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_ri);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_sl);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_slmult);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_nowidctlpar);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_tqr);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_tldot);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_tx);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_hyphpar);
}
Beispiel #3
0
/**
This is the entry point for parsing when you have source stream and the textual name
of that stream, and is also called
*/
bool ZASParser::sParse(
    const ZFileSpec& iFileSpec, const ZStreamR& iStream, ParseHandler& iParseHandler,
    const StreamProvider& iStreamProvider,
    const ErrorHandler& iErrorHandler, IncludeHandler* iIncludeHandler)
{
    try
    {
        Parser theParser(iParseHandler, iStreamProvider, iErrorHandler, iIncludeHandler);
        iParseHandler.StartParse();
        theParser.Parse(iFileSpec, iStream);
        iParseHandler.EndParse();
        return true;
    }
    catch (NestedParse& ex)
    {
        printf("EX4\n");
        iErrorHandler.ReportError(ex.GetSources(), ex.GetMessage());
    }
    catch (exception& ex)
    {
        printf("EX5\n");
        iErrorHandler.ReportError(ex.what());
    }
    catch (...)
    {
        iErrorHandler.ReportError("Unknown exception");
    }
    return false;
}
Beispiel #4
0
void TestRTFAText::TestReadTokenSequence_rtl()
{
	ComparisonContext cContext;
	RTFFileContext context;
	RTFatext_rtl textObject(&context);
	CTestOnlyRFTParser theParser(&context);	
	CTestOnlyRTFInputFile TheTest("\\rtlch\\af37\\ltrch\\af27");
	
	theParser.SetFile(&TheTest);

	assertTest(theParser.GetToken() == rtfcw_rtlch);
	assertTest(textObject.AcceptsToken(rtfcw_rtlch));
	assertTest(textObject.ReadToken(rtfcw_rtlch, &theParser) == rtfec_OK);

	assertTest(theParser.GetToken() == rtfcw_af);
	assertTest(textObject.AcceptsToken(rtfcw_af));
	assertTest(textObject.ReadToken(rtfcw_af, &theParser) == rtfec_OK);

	assertTest(theParser.GetToken() == rtfcw_ltrch);
	assertTest(textObject.AcceptsToken(rtfcw_ltrch));
	assertTest(textObject.ReadToken(rtfcw_ltrch, &theParser) == rtfec_OK);

	assertTest(theParser.GetToken() == rtfcw_af);
	assertTest(textObject.AcceptsToken(rtfcw_af));
	assertTest(textObject.ReadToken(rtfcw_af, &theParser) == rtfec_OK);

	assertTest(textObject.m_iTok1 == tok_rtlrun);
	assertTest(textObject.m_iTok2 == tok_ltrrun);
	
	assertTest(textObject.m_iAf1 == 37);
	assertTest(textObject.m_iAf2 == 27);
	
	assertTest(textObject.m_b1sf == false);
	assertTest(textObject.m_b2sf == false);
}
void TestBasicRTFParser::SkipUnwantedTokens()
{
	ComparisonContext cContext;
	RTFFileContext context;
	RTFParser theParser(&context);	
	CTestOnlyRTFInputFile TheTest("\\nooverflow\\rin\\lin");

	theParser.SetFile(&TheTest);
	ERTFToken thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfrc_EndOfFile);
}
Beispiel #6
0
void  RTSPRequest::ParseDynamicRateHeader()
{
	StringParser theParser(fHeaderDictionary.GetValue(qtssXDynamicRateHeader));
    theParser.ConsumeWhitespace();
	SInt32 value = theParser.ConsumeInteger(NULL);

	// fEnableDynamicRate: < 0 undefined, 0 disable, > 0 enable
	if (value > 0)
	    fEnableDynamicRateState = 1;
	else
	    fEnableDynamicRateState = 0;
}
Beispiel #7
0
int main(int argc, char** argv)
{
	//ensure there is an input file specified
	if (argc < 1)
	{
		return EXIT_FAILURE;
	}

	//save input file into a string stream
	std::ostringstream inputFile;
	inputFile << argv[1];

	//construct an empty circuit
	DcCircuit theCircuit;
	std::cout << "Constructed DcCircuit." << std::endl;

	//create a file parser and populate the circuit
	FileParser theParser(inputFile.str(), theCircuit);
	theParser.buildCircuit();
	std::cout << "Constructed FileParser and populated DcCircuit." << std::endl;

	//create a file writer and output the circuit as a netlist and .ps file
	//loop through and remove any folders preceding file name
	std::string fileName = inputFile.str();
	for (int i = 0; i < fileName.length(); i++)
	{
		//if folder names exist before filename
		if (fileName[i] == '/')
		{
			//remove folder name
			fileName = fileName.substr(i + 1);
			//restart loop
			i = -1;
		}
	}

	//loop through and remove file extension after file name
	for (int i = 0; i < fileName.length(); i++)
	{
		if (fileName[i] == '.')
		{
			//remove file extension
			fileName = fileName.substr(0, i);
		}
	}

	FileWriter theWriter(theCircuit, fileName);
	theWriter.printNetList();
	theWriter.printDiagram();
	std::cout << "Constructed FileWriter and output netlist and .ps files." << std::endl;

	return EXIT_SUCCESS;
}
Beispiel #8
0
void TestRTFAText::TestReadTokenSequence_xxch()
{
	ComparisonContext cContext;
	RTFFileContext context;
	RTFatext_xxch textObject(&context);
	CTestOnlyRFTParser theParser(&context);	
	CTestOnlyRTFInputFile TheTest("\\hich\\af37\\loch\\af27\\dbch\\f17");
	
	
	theParser.SetFile(&TheTest);
	theParser.SetDoubleChars(true);

	assertTest(theParser.GetToken() == rtfcw_hich);
	assertTest(textObject.AcceptsToken(rtfcw_hich));
	assertTest(textObject.ReadToken(rtfcw_hich, &theParser) == rtfec_OK);
	assertTest(!theParser.IsInDoubleChars());

	assertTest(theParser.GetToken() == rtfcw_af);
	assertTest(textObject.AcceptsToken(rtfcw_af));
	assertTest(textObject.ReadToken(rtfcw_af, &theParser) == rtfec_OK);

	assertTest(theParser.GetToken() == rtfcw_loch);
	assertTest(textObject.AcceptsToken(rtfcw_loch));
	assertTest(textObject.ReadToken(rtfcw_loch, &theParser) == rtfec_OK);
	assertTest(!theParser.IsInDoubleChars());

	assertTest(theParser.GetToken() == rtfcw_af);
	assertTest(textObject.AcceptsToken(rtfcw_af));
	assertTest(textObject.ReadToken(rtfcw_af, &theParser) == rtfec_OK);

	assertTest(theParser.GetToken() == rtfcw_dbch);
	assertTest(textObject.AcceptsToken(rtfcw_dbch));
	assertTest(textObject.ReadToken(rtfcw_dbch, &theParser) == rtfec_OK);
	assertTest(theParser.IsInDoubleChars());

	assertTest(theParser.GetToken() == rtfcw_f);
	assertTest(textObject.AcceptsToken(rtfcw_f));
	assertTest(textObject.ReadToken(rtfcw_f, &theParser) == rtfec_OK);
	
	assertTest(textObject.m_iTok1 == tok_hich);
	assertTest(textObject.m_iTok2 == tok_loch);
	assertTest(textObject.m_iTok3 == tok_dbch);
	
	assertTest(textObject.m_iAf1 == 37);
	assertTest(textObject.m_iAf2 == 27);
	assertTest(textObject.m_iAf3 == 17);
	
	assertTest(textObject.m_b1sf == false);
	assertTest(textObject.m_b2sf == false);
	assertTest(textObject.m_b3sf == true);
}
void TestBasicRTFParser::ParseNestedOptionalGroups()
{
	ComparisonContext cContext;
	RTFFileContext context;
	CTestOnlyRFTParser theParser(&context);	
	CTestOnlyRTFInputFile TheTest("{\\trowd{\\*\\fchars {\\this\\need not even be valid\\lin}\\cs10}\\sl360");

	theParser.SetFile(&TheTest);
	ERTFToken thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_trowd);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_sl);

}
Beispiel #10
0
         void CIniImpl::parse()
         {
            TRACE_FUN( Routine, "CIniImpl::parse" );

            CLexScaner scaner( &stream() );
            CCategoryParserDriver driver( file(),
                                          scaner,
                                          category(),
                                          synchronization(),
                                          errorRepository() );

            parser theParser( driver );
            theParser.parse();
         }
void TestBasicRTFParser::ParseOptionalGroupWithLiteralBrace()
{
	ComparisonContext cContext;
	RTFFileContext context;
	CTestOnlyRFTParser theParser(&context);	
	CTestOnlyRTFInputFile TheTest("{\\trowd{\\*\\fchars {Problem? \\} No problem! \\lin}\\cs10}\\sl360");

	theParser.SetFile(&TheTest);
	ERTFToken thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_trowd);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_sl);

}
Beispiel #12
0
CBabelData ReadBabel (IMemoryBlock &Input)

//	ReadBabel
//
//	Reads and loads babel text. Throws CException if there are errors

{
    char *pPos = Input.GetPointer();
    char *pEndPos = pPos + Input.GetLength();

    CParser theParser(pPos, pEndPos);

    return theParser.Parse();
}
void TestBasicRTFParser::ParseIncompleteOptionalGroup()
{
	ComparisonContext cContext;
	RTFFileContext context;
	CTestOnlyRFTParser theParser(&context);	
	CTestOnlyRTFInputFile TheTest("\\trowd{\\*\\fchars{\\Oops");

	theParser.SetFile(&TheTest);
	ERTFToken thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_trowd);

	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfrc_EndOfFile); // N.B. escapes an implied infinite loop

}
void TestBasicRTFParser::ParseUnwantedOptionalGroup()
{
	ComparisonContext cContext;
	AFX_MANAGE_STATE(AfxGetStaticModuleState())
		// Using derived class to disable scope add and remove problems
	RTFFileContext context;
	CTestOnlyRFTParser theParser(&context);	
	CTestOnlyRTFInputFile TheTest("{\\*\\Generator Bill added this in XP!}\\trowd");
	RTFTable rtfDest(&context);

	theParser.SetFile(&TheTest);
	theParser.SetContentDestination(&rtfDest);

	ERTFToken thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_trowd);
}
void TestBasicRTFParser::ReadSingleTokens()
{
	ComparisonContext cContext;
	RTFFileContext context;
	RTFParser theParser(&context);	
	CTestOnlyRTFInputFile Test1("\\trowd");

	theParser.SetFile(&Test1);
	ERTFToken thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_trowd);

	CTestOnlyRTFInputFile Test2("\\brdrs");

	theParser.SetFile(&Test2);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_brdrs);
}
void TestBasicRTFParser::ParseDocumentFormat()
{
	ComparisonContext cContext;
	RTFFileContext context;
	CTestOnlyRFTParser theParser(&context);	
	CTestOnlyRTFInputFile TheTest("{\\aftnbj\\lnbrkrule");
	RTFdocfmt docfmt(&context);

	theParser.SetFile(&TheTest);
	theParser.SetDestination(&docfmt);
	ERTFToken thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_aftnbj);

	assertTest(!docfmt.the_DocumentCompatibilityOptions.m_bLnBrkRule);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_lnbrkrule);
	assertTest(docfmt.ReadToken(thertfToken, &theParser) == rtfec_OK);
	assertTest(docfmt.the_DocumentCompatibilityOptions.m_bLnBrkRule);
}
Beispiel #17
0
void
XercesParserLiaison::parseXMLStream(
			const InputSourceType&	urlInputSource,
			DocumentHandlerType&	handler,
			const XalanDOMString&	/* identifier */)
{
	XalanAutoPtr<SAXParserType> 	theParser(CreateSAXParser());

	theParser->setDocumentHandler(&handler);

	if (m_errorHandler == 0)
	{
		theParser->setErrorHandler(this);
	}
	else
	{
		theParser->setErrorHandler(m_errorHandler);
	}

	theParser->parse(urlInputSource);
}
Beispiel #18
0
Bool16 XMLParser::ParseFile(char* errorBuffer, int errorBufferSize)
{
    if (fRootTag != NULL)
    {
        delete fRootTag;    // flush old data
        fRootTag = NULL;
    }
    
    fFile.Set(fFilePath);

    if (errorBufferSize < 500) errorBuffer = NULL;  // Just a hack to avoid checking everywhere
    if ((fFile.GetLength() == 0) || fFile.IsDir())
    {
        if (errorBuffer != NULL)
            qtss_snprintf(errorBuffer, errorBufferSize,  "Couldn't read xml file");
        return false;   // we don't have a valid file;
    }
    
    char* fileData = NEW char[ (SInt32) (fFile.GetLength() + 1)];
    UInt32 theLengthRead = 0;
    fFile.Read(0, fileData, (UInt32) fFile.GetLength(), &theLengthRead); 

    StrPtrLen theDataPtr(fileData, theLengthRead);
    StringParser theParser(&theDataPtr);
    
    fRootTag = NEW XMLTag();
    Bool16 result = fRootTag->ParseTag(&theParser, fVerifier, errorBuffer, errorBufferSize);
    if (!result)
    {
        // got error parsing file
        delete fRootTag;
        fRootTag = NULL;
    }
    
    delete []fileData;
    
    fFile.Close();

    return result;
}
Beispiel #19
0
//-----------------------------------------------------------------------------
// Function      : ReactionNetwork::setReactionNetworkFromFile
// Purpose       : Parse a reaction network specification file and set the
//                 network up.
//                 
// Special Notes : 
//
// Scope         : public
// Creator       : Tom Russo, SNL, Electrical and Microsystems Modeling
// Creation Date : 08/24/06
//-----------------------------------------------------------------------------
void 
ReactionNetwork::setReactionNetworkFromFile(const std::string &fileName)
{
#ifdef Xyce_REACTION_PARSER
  if (fileName != "") // do nothing if no file specified
  {
    // Get the reaction set from a file
    ReactionLexer *theLexer;
    std::ifstream reactionFile;
    std::map<std::string,int> theSpeciesIDs;        
    
    // temporary hard-coded filename
    reactionFile.open(fileName.c_str(),std::ios::in);
    if (reactionFile.is_open())
    {
      theLexer=new ReactionLexer(&reactionFile);
    }
    else
    {
      Report::UserError() << "ReactionNetwork::setReactionNetworkFromFile:  Cannot open reaction specification file: " << fileName;
    }
    
    XyceDevice::ReactionParser theParser(theLexer, theSpeciesIDs, *this);
    
    
    if (theParser.parse())
    {
#ifdef Xyce_DEBUG_DEVICE
      Xyce::dout() << *this << std::endl;
#endif
      Report::UserError() << "ReactionNetwork::setReactionNetworkFromFile:  Parsing reaction spec from file " <<  fileName  << " failed.";
    }
    
    // we're done with this:
    delete theLexer;
  }
#endif
  
}
void TestBasicRTFParser::ParseWantedOptionalGroup()
{
	ComparisonContext cContext;
	// Using derived class to disable scope add and remove problems
	RTFFileContext context;
	CTestOnlyRFTParser theParser(&context);	
	CTestOnlyRTFInputFile TheTest("{\\*\\cs10 \\additive Default Paragraph Font;}\\trowd");

	theParser.SetFile(&TheTest);
	ERTFToken thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_cs);
	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_additive);

	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == 'D');

	do
	thertfToken = theParser.GetToken(false);
	while( thertfToken != ';');

	thertfToken = theParser.GetToken(false);
	assertTest(thertfToken == rtfcw_trowd);
}
Beispiel #21
0
XalanDocument*
XercesParserLiaison::parseXMLStream(
			const InputSourceType&	reader,
			const XalanDOMString&	/* identifier */)
{
	XalanAutoPtr<DOMParserType> 		theParser(CreateDOMParser());

	if (m_errorHandler == 0)
	{
		theParser->setErrorHandler(this);
	}
	else
	{
		theParser->setErrorHandler(m_errorHandler);
	}

	theParser->parse(reader);

#if XERCES_VERSION_MAJOR >= 2
	DOMDocument_Type* const	theXercesDocument =
		theParser->getDocument();

	theXercesDocument->normalize();
#else
	DOM_Document_Type	theXercesDocument =
		theParser->getDocument();

	theXercesDocument.normalize();
#endif

#if XERCES_VERSION_MAJOR >= 2
	XercesDocumentWrapper*	theNewDocument = 0;

	if (theXercesDocument != 0)
	{
		theNewDocument = doCreateDocument(theXercesDocument, m_threadSafe, m_buildWrapper, m_buildMaps, true);

		theParser->adoptDocument();
#else
	XercesDocumentBridge*	theNewDocument = 0;

	if (theXercesDocument.isNull() == false)
	{
		theNewDocument = doCreateDocument(theXercesDocument, m_threadSafe, m_buildBridge, true);
#endif
	}

	return theNewDocument;
}



void
XercesParserLiaison::destroyDocument(XalanDocument* 	theDocument)
{
	const DocumentMapType::iterator		i =
		m_documentMap.find(theDocument);

	if (i != m_documentMap.end())
	{
		const XalanAutoPtr<XalanDocument>	theGuard(theDocument);

		m_documentMap.erase(i);
	}
}



int
XercesParserLiaison::getIndent() const
{
	return m_indent;
}



void
XercesParserLiaison::setIndent(int	i)
{
	m_indent = i;
}



bool
XercesParserLiaison::getUseValidation() const
{
	return m_useValidation;
}



void
XercesParserLiaison::setUseValidation(bool	b)
{
	m_useValidation = b;
}



const XalanDOMString
XercesParserLiaison::getParserDescription() const
{
	return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("Xerces"));
}


DOMDocument_Type*
XercesParserLiaison::createDOMFactory()
{
    DOMDocument_Type* const     theXercesDocument =
        DOMImplementationType::getImplementation()->createDocument();

	createDocument(theXercesDocument, false, false);
	
    return theXercesDocument;
}



void
XercesParserLiaison::destroyDocument(DOMDocument_Type*  theDocument)
{
	// Delete any live documents...
	for(DocumentMapType::iterator i = m_documentMap.begin();
		i != m_documentMap.end();
		++i)
	{
		if ((*i).second.isDeprecated() == false &&
			(*i).second.m_wrapper->getXercesDocument() == theDocument)
		{
            destroyDocument((XalanDocument*)(*i).first);
		}
	}
}



bool
XercesParserLiaison::getIncludeIgnorableWhitespace() const
{
	return m_includeIgnorableWhitespace;
}



void
XercesParserLiaison::setIncludeIgnorableWhitespace(bool include)
{
	m_includeIgnorableWhitespace = include;
}



ErrorHandlerType*
XercesParserLiaison::getErrorHandler() const
{
	return m_errorHandler;
}



void
XercesParserLiaison::setErrorHandler(ErrorHandlerType*	handler)
{
	m_errorHandler = handler;
}



bool
XercesParserLiaison::getDoNamespaces() const
{
	return m_doNamespaces;
}



void
XercesParserLiaison::setDoNamespaces(bool	newState)
{
	m_doNamespaces = newState;
}



bool
XercesParserLiaison::getExitOnFirstFatalError() const
{
	return m_exitOnFirstFatalError;
}



void
XercesParserLiaison::setExitOnFirstFatalError(bool	newState)
{
	m_exitOnFirstFatalError = newState;
}



EntityResolverType*
XercesParserLiaison::getEntityResolver() const
{
	return m_entityResolver;
}



void
XercesParserLiaison::setEntityResolver(EntityResolverType*	resolver)
{
	m_entityResolver = resolver;
}



const XalanDOMChar*
XercesParserLiaison::getExternalSchemaLocation() const
{
	return m_externalSchemaLocation.length() == 0 ? 0 : m_externalSchemaLocation.c_str();
}



void
XercesParserLiaison::setExternalSchemaLocation(const XalanDOMChar*	location)
{
	if (location == 0)
	{
		m_externalSchemaLocation.clear();
	}
	else
	{
		m_externalSchemaLocation = location;
	}
}



const XalanDOMChar*
XercesParserLiaison::getExternalNoNamespaceSchemaLocation() const
{
	return m_externalNoNamespaceSchemaLocation.length() == 0 ? 0 : m_externalNoNamespaceSchemaLocation.c_str();
}



void
XercesParserLiaison::setExternalNoNamespaceSchemaLocation(const XalanDOMChar*	location)
{
	if (location == 0)
	{
		m_externalNoNamespaceSchemaLocation.clear();
	}
	else
	{
		m_externalNoNamespaceSchemaLocation= location;
	}
}



#if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
XalanDocument*
XercesParserLiaison::createDocument(
			const DOM_Document_Type& 	theXercesDocument,
			bool						threadSafe,
			bool						buildBridge)
{
	return doCreateDocument(theXercesDocument, threadSafe, buildBridge);
}
#endif



XalanDocument*
XercesParserLiaison::createDocument(
			const DOMDocument_Type*		theXercesDocument,
			bool						threadSafe,
			bool						buildWrapper,
			bool						buildMaps)
{
	// As we did not create the underlying DOMDocument - ensure we don't
	// delete it later.
	return doCreateDocument(theXercesDocument, threadSafe, buildWrapper, buildMaps, false);
}



#if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
XercesDocumentBridge*
XercesParserLiaison::mapDocument(const XalanDocument*	theDocument) const
{
	const DocumentMapType::const_iterator	i =
		m_documentMap.find(theDocument);

	return i != m_documentMap.end() ? (*i).second.m_isDeprecated == true ? (*i).second.m_bridge : 0 : 0;
}
#endif



XercesDocumentWrapper*
XercesParserLiaison::mapDocumentToWrapper(const XalanDocument*	theDocument) const
{
	const DocumentMapType::const_iterator	i =
		m_documentMap.find(theDocument);

	return i != m_documentMap.end() ? (*i).second.isDeprecated() == false ? (*i).second.m_wrapper : 0 : 0;
}



#if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
DOM_Document_Type
XercesParserLiaison::mapXercesDocument(const XalanDocument* 	theDocument) const
{
	const DocumentMapType::const_iterator	i =
		m_documentMap.find(theDocument);

	return i != m_documentMap.end() ? (*i).second.isDeprecated() == true ? (*i).second.m_bridge->getXercesDocument() : DOM_Document_Type() : DOM_Document_Type();
}
#endif



const DOMDocument_Type*
XercesParserLiaison::mapToXercesDocument(const XalanDocument*	theDocument) const
{
	const DocumentMapType::const_iterator	i =
		m_documentMap.find(theDocument);

	return i != m_documentMap.end() ? (*i).second.isDeprecated() == false ? (*i).second.m_wrapper->getXercesDocument() : 0 : 0;
}



void
XercesParserLiaison::fatalError(const SAXParseExceptionType&	e)
{
	XalanDOMString	theMessage = XalanMessageLoader::getMessage(XalanMessages::FatalError);

	formatErrorMessage(e, theMessage);

	if (m_executionContext != 0)
	{
		// We call warning() because we don't want the execution
		// context to potentially throw an exception.
		m_executionContext->warn(theMessage);
	}
	else
	{
		XALAN_USING_STD(cerr)
		XALAN_USING_STD(endl)

		cerr << endl << theMessage << endl;
	}

	throw e;
}