XMLElementDecl* DTDGrammar::putElemDecl (const unsigned int uriId , const XMLCh* const , const XMLCh* const , const XMLCh* const qName , unsigned int , const bool notDeclared) { DTDElementDecl* retVal = new (fMemoryManager) DTDElementDecl ( qName , uriId , DTDElementDecl::Any , fMemoryManager ); if(notDeclared) { if(!fElemNonDeclPool) fElemNonDeclPool = new (fMemoryManager) NameIdPool<DTDElementDecl>(29, 128, fMemoryManager); retVal->setId(fElemNonDeclPool->put(retVal)); } else { retVal->setId(fElemDeclPool->put(retVal)); } return retVal; }
void TestParser::elementDecl(const DTDElementDecl& decl , const bool isIgnored) { if (fOutputType == OutputType_Debug) { XERCES_STD_QUALIFIER cout << "Got ELEMENT DECL:\n " << "Name: " << StrX(decl.getFullName()); if (isIgnored) XERCES_STD_QUALIFIER cout << " (Ignored)"; XERCES_STD_QUALIFIER cout << ", Content: " << StrX(decl.getFormattedContentModel()) << "\n SrcOfs: " << fScanner->getSrcOffset() << "\n" << XERCES_STD_QUALIFIER endl; } else if (fOutputType != OutputType_None) { if (fInExtSubset) return; if (fIntDTDOutput) { XERCES_STD_QUALIFIER cout << "<!ELEMENT " << StrX(decl.getFullName()) << " " << StrX(decl.getFormattedContentModel()) << ">"; } } }
// ----------------------------------------------------------------------- // Virtual methods // ----------------------------------------------------------------------- XMLElementDecl* DTDGrammar::findOrAddElemDecl (const unsigned int uriId , const XMLCh* const baseName , const XMLCh* const , const XMLCh* const qName , unsigned int scope , bool& wasAdded ) { // See it it exists DTDElementDecl* retVal = (DTDElementDecl*) getElemDecl(uriId, baseName, qName, scope); // if not, then add this in if (!retVal) { retVal = new (fMemoryManager) DTDElementDecl ( qName , uriId , DTDElementDecl::Any , fMemoryManager ); if(!fElemNonDeclPool) fElemNonDeclPool = new (fMemoryManager) NameIdPool<DTDElementDecl>(29, 128, fMemoryManager); const unsigned int elemId = fElemNonDeclPool->put(retVal); retVal->setId(elemId); wasAdded = true; } else { wasAdded = false; } return retVal; }
void TestParser::doctypeDecl(const DTDElementDecl& elemDecl , const XMLCh* const publicId , const XMLCh* const systemId , const bool hasIntSubset) { if (fOutputType == OutputType_Debug) { XERCES_STD_QUALIFIER cout << "Got DOCTYPE:\n " << "Root: " << StrX(elemDecl.getFullName()); if (XMLString::stringLen(publicId)) XERCES_STD_QUALIFIER cout << ", PUBLIC: " << StrX(publicId); if (XMLString::stringLen(systemId)) XERCES_STD_QUALIFIER cout << ", SYSTEM: " << StrX(systemId); XERCES_STD_QUALIFIER cout << "\n SrcOfs: " << fScanner->getSrcOffset() << "\n" << XERCES_STD_QUALIFIER endl; } else if (fOutputType != OutputType_None) { if (fIntDTDOutput) { XERCES_STD_QUALIFIER cout << "<!DOCTYPE " << StrX(elemDecl.getFullName()); showIds(publicId, systemId); if (!hasIntSubset) XERCES_STD_QUALIFIER cout << ">"; } } }
void TestParser::startAttList(const DTDElementDecl& elemDecl) { if (fOutputType == OutputType_Debug) { XERCES_STD_QUALIFIER cout << "Got STARTATTLIST:\n " << "Name: " << StrX(elemDecl.getFullName()) << "\n" << XERCES_STD_QUALIFIER endl; } else if (fOutputType != OutputType_None) { if (fInExtSubset) return; if (fIntDTDOutput) XERCES_STD_QUALIFIER cout << "<!ATTLIST " << StrX(elemDecl.getFullName()); } }
void NsSAX2Reader::startAttList(const DTDElementDecl &elemDecl) { if (fReadingIntSubset) { fSubset.append(chOpenAngle); fSubset.append(chBang); fSubset.append(XMLUni::fgAttListString); fSubset.append(chSpace); fSubset.append(elemDecl.getFullName()); } }
void NsSAX2Reader::elementDecl(const DTDElementDecl& elemDecl, const_bool isIgnored) { if (fReadingIntSubset) { fSubset.append(chOpenAngle); fSubset.append(chBang); fSubset.append(XMLUni::fgElemString); fSubset.append(chSpace); fSubset.append(elemDecl.getFullName()); //get the ContentSpec information const XMLCh* contentModel = elemDecl.getFormattedContentModel(); if (contentModel != 0) { fSubset.append(chSpace); fSubset.append(contentModel); } fSubset.append(chCloseAngle); } }
void TestParser::endAttList(const DTDElementDecl& elemDecl) { if (fOutputType == OutputType_Debug) { XERCES_STD_QUALIFIER cout << "Got ENDATTLIST:\n " << "Name: " << StrX(elemDecl.getFullName()) << "\n" << " SrcOfs: " << fScanner->getSrcOffset() << "\n" << XERCES_STD_QUALIFIER endl; } else if (fOutputType != OutputType_None) { if (fInExtSubset) return; if (fIntDTDOutput) XERCES_STD_QUALIFIER cout << ">"; } }
void NsSAX2Reader::doctypeDecl(const DTDElementDecl& elemDecl, const XMLCh* const publicId, const XMLCh* const systemId, const_bool hasIntSubset, const_bool hasExtSubset) { fSubset.append(XMLUni::fgDocTypeString); fSubset.append(chSpace); fSubset.append(elemDecl.getFullName()); fSubset.append(chSpace); if (publicId && *publicId) { fSubset.append(XMLUni::fgPubIDString); fSubset.append(chSpace); fSubset.append(chDoubleQuote); fSubset.append(publicId); fSubset.append(chDoubleQuote); fSubset.append(chSpace); } if (systemId && *systemId) { if (!(publicId && *publicId)) { fSubset.append(XMLUni::fgSysIDString); fSubset.append(chSpace); } fSubset.append(chDoubleQuote); fSubset.append(systemId); fSubset.append(chDoubleQuote); } if (hasIntSubset) { fSubset.append(gStartIntSubset); fHasIntSubset = true; } else if (hasExtSubset) { fHasExtSubset = true; fSubset.append(gEndExtSubset); } }
// --------------------------------------------------------------------------- // NsSAX2Reader: Overrides of the DocTypeHandler interface // --------------------------------------------------------------------------- void NsSAX2Reader::attDef(const DTDElementDecl& elemDecl, const DTDAttDef& attDef, const_bool ignoring) { if (fReadingIntSubset) { if (elemDecl.hasAttDefs()) { fSubset.append(attDef.getFullName()); // Get the type and display it const XMLAttDef::AttTypes type = attDef.getType(); switch(type) { case XMLAttDef::CData : fSubset.append(chSpace); fSubset.append(XMLUni::fgCDATAString); break; case XMLAttDef::ID : fSubset.append(chSpace); fSubset.append(XMLUni::fgIDString); break; case XMLAttDef::IDRef : fSubset.append(chSpace); fSubset.append(XMLUni::fgIDRefString); break; case XMLAttDef::IDRefs : fSubset.append(chSpace); fSubset.append(XMLUni::fgIDRefsString); break; case XMLAttDef::Entity : fSubset.append(chSpace); fSubset.append(XMLUni::fgEntityString); break; case XMLAttDef::Entities : fSubset.append(chSpace); fSubset.append(XMLUni::fgEntitiesString); break; case XMLAttDef::NmToken : fSubset.append(chSpace); fSubset.append(XMLUni::fgNmTokenString); break; case XMLAttDef::NmTokens : fSubset.append(chSpace); fSubset.append(XMLUni::fgNmTokensString); break; case XMLAttDef::Notation : fSubset.append(chSpace); fSubset.append(XMLUni::fgNotationString); break; case XMLAttDef::Enumeration : { fSubset.append(chSpace); const XMLCh* enumString = attDef.getEnumeration(); int length = (int) XercesStringLen(enumString); if (length > 0) { fSubset.append(chOpenParen ); for(int i=0; i<length; i++) { if (enumString[i] == chSpace) fSubset.append(chPipe); else fSubset.append(enumString[i]); } fSubset.append(chCloseParen); } } break; default : break; } //get te default types of the attlist const XMLAttDef::DefAttTypes def = attDef.getDefaultType(); switch(def) { case XMLAttDef::Required : fSubset.append(chSpace); fSubset.append(XMLUni::fgRequiredString); break; case XMLAttDef::Implied : fSubset.append(chSpace); fSubset.append(XMLUni::fgImpliedString); break; case XMLAttDef::Fixed : fSubset.append(chSpace); fSubset.append(XMLUni::fgFixedString); break; default : break; } const XMLCh* defaultValue = attDef.getValue(); if (defaultValue != 0) { fSubset.append(chSpace); fSubset.append(chDoubleQuote); fSubset.append(defaultValue); fSubset.append(chDoubleQuote); } } } }