void TestParser::entityDecl(const   DTDEntityDecl&  entityDecl
                            , const bool            isPEDecl
                            , const bool            isIgnored)
{
    if (fOutputType == OutputType_Debug)
    {
        XERCES_STD_QUALIFIER cout << "Got ENTITYDECL:\n    "
             << "Name: " << StrX(entityDecl.getName())
             << (isPEDecl ? " [Parameter Entity]" : " [General Entity]")
             << "\n" << XERCES_STD_QUALIFIER endl;
    }
     else if (fOutputType != OutputType_None)
    {
        if (fInExtSubset)
            return;

        if (fIntDTDOutput)
        {
            XERCES_STD_QUALIFIER cout << "<!ENTITY ";
            if (isPEDecl)
                XERCES_STD_QUALIFIER cout << "% ";
            XERCES_STD_QUALIFIER cout << StrX(entityDecl.getName());

            if (entityDecl.isExternal())
                showIds(entityDecl.getPublicId(), entityDecl.getSystemId());
             else
                XERCES_STD_QUALIFIER cout << " \"" << StrX(entityDecl.getValue()) << "\"";

            XERCES_STD_QUALIFIER cout << ">";
        }
    }
}
示例#2
0
void NsSAX2Reader::entityDecl(const DTDEntityDecl& entityDecl,
			       const_bool isPEDecl,
			       const_bool isIgnored)
{
	if (fReadingIntSubset) {
		//add these chars to internalSubset variable
		fSubset.append(chOpenAngle);
		fSubset.append(chBang);
		fSubset.append(XMLUni::fgEntityString);
		fSubset.append(chSpace);

		fSubset.append(entityDecl.getName());

		const XMLCh* id = entityDecl.getPublicId();
		if (id != 0) {
			fSubset.append(chSpace);
			fSubset.append(XMLUni::fgPubIDString);
			fSubset.append(chSpace);
			fSubset.append(chDoubleQuote);
			fSubset.append(id);
			fSubset.append(chDoubleQuote);
		}
		id = entityDecl.getSystemId();
		if (id != 0) {
			fSubset.append(chSpace);
			fSubset.append(XMLUni::fgSysIDString);
			fSubset.append(chSpace);
			fSubset.append(chDoubleQuote);
			fSubset.append(id);
			fSubset.append(chDoubleQuote);

		}
		id = entityDecl.getNotationName();
		if (id != 0) {
			fSubset.append(chSpace);
			fSubset.append(XMLUni::fgNDATAString);
			fSubset.append(chSpace);
			fSubset.append(id);
		}
		id = entityDecl.getValue();
		if (id !=0) {
			fSubset.append(chSpace);
			fSubset.append(chDoubleQuote);
			fSubset.append(id);
			fSubset.append(chDoubleQuote);
		}

		fSubset.append(chCloseAngle);
	}
}
void SAXParser::entityDecl( const   DTDEntityDecl&  entityDecl
                            , const bool
                            , const bool            isIgnored)
{
    //
    //  If we have a DTD handler, and this entity is not ignored, and
    //  its an unparsed entity, then send this one.
    //
    if (fDTDHandler && !isIgnored)
    {
        if (entityDecl.isUnparsed())
        {
            fDTDHandler->unparsedEntityDecl
            (
                entityDecl.getName()
                , entityDecl.getPublicId()
                , entityDecl.getSystemId()
                , entityDecl.getNotationName()
            );
        }
    }
}