bool DOMSerializer::getFeature(const XMLString& featureId) const { if (featureId == XMLReader::FEATURE_NAMESPACES) throw SAXNotSupportedException(fromXMLString(XMLReader::FEATURE_NAMESPACES)); else if (featureId == XMLReader::FEATURE_NAMESPACE_PREFIXES) throw SAXNotSupportedException(fromXMLString(XMLReader::FEATURE_NAMESPACE_PREFIXES)); else throw SAXNotRecognizedException(fromXMLString(featureId)); }
void DOMSerializer::setProperty(const XMLString& propertyId, const XMLString& value) { if (propertyId == XMLReader::PROPERTY_DECLARATION_HANDLER || propertyId == XMLReader::PROPERTY_LEXICAL_HANDLER) throw SAXNotSupportedException(std::string("property does not take a string value: ") + fromXMLString(propertyId)); else throw SAXNotRecognizedException(fromXMLString(propertyId)); }
void GMLXercesHandler::endElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname ) { char szElementName[MAX_TOKEN_SIZE]; m_nEntityCounter = 0; /* A XMLCh character can expand to 4 bytes in UTF-8 */ if (4 * tr_strlen( localname ) >= MAX_TOKEN_SIZE) { XMLCh* tempBuffer = (XMLCh*) CPLMalloc(sizeof(XMLCh) * (MAX_TOKEN_SIZE / 4 + 1)); memcpy(tempBuffer, localname, sizeof(XMLCh) * (MAX_TOKEN_SIZE / 4)); tempBuffer[MAX_TOKEN_SIZE / 4] = 0; tr_strcpy( szElementName, tempBuffer ); CPLFree(tempBuffer); } else tr_strcpy( szElementName, localname ); if (GMLHandler::endElement(szElementName) == CE_Failure) { throw SAXNotSupportedException("Out of memory"); } }
void GMLXercesHandler::startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs ) { char szElementName[MAX_TOKEN_SIZE]; m_nEntityCounter = 0; /* A XMLCh character can expand to 4 bytes in UTF-8 */ if (4 * tr_strlen( localname ) >= MAX_TOKEN_SIZE) { static int bWarnOnce = FALSE; XMLCh* tempBuffer = (XMLCh*) CPLMalloc(sizeof(XMLCh) * (MAX_TOKEN_SIZE / 4 + 1)); memcpy(tempBuffer, localname, sizeof(XMLCh) * (MAX_TOKEN_SIZE / 4)); tempBuffer[MAX_TOKEN_SIZE / 4] = 0; tr_strcpy( szElementName, tempBuffer ); CPLFree(tempBuffer); if (!bWarnOnce) { bWarnOnce = TRUE; CPLError(CE_Warning, CPLE_AppDefined, "A too big element name has been truncated"); } } else tr_strcpy( szElementName, localname ); if (GMLHandler::startElement(szElementName, (void*) &attrs) == CE_Failure) { throw SAXNotSupportedException("Out of memory"); } }
void ILI2Handler::startEntity (CPL_UNUSED const XMLCh *const name) { m_nEntityCounter++; if (m_nEntityCounter > 1000) { throw SAXNotSupportedException ("File probably corrupted (million laugh pattern)"); } }
void WhitespaceFilter::setProperty(const XMLString& propertyId, const XMLString& value) { if (propertyId == XMLReader::PROPERTY_LEXICAL_HANDLER) throw SAXNotSupportedException(std::string("property does not take a string value: ") + fromXMLString(propertyId)); else XMLFilterImpl::setProperty(propertyId, value); }
void* DOMSerializer::getProperty(const XMLString& propertyId) const { if (propertyId == XMLReader::PROPERTY_DECLARATION_HANDLER) return _pDeclHandler; else if (propertyId == XMLReader::PROPERTY_LEXICAL_HANDLER) return _pLexicalHandler; else throw SAXNotSupportedException(fromXMLString(propertyId)); }
void* SAXParser::getProperty(const XMLString& propertyId) const { if (propertyId == XMLReader::PROPERTY_DECLARATION_HANDLER) return _engine.getDeclHandler(); else if (propertyId == XMLReader::PROPERTY_LEXICAL_HANDLER) return _engine.getLexicalHandler(); else throw SAXNotSupportedException(fromXMLString(propertyId)); }
void GMLXercesHandler::startEntity (const XMLCh *const name) { m_nEntityCounter ++; if (m_nEntityCounter > 1000 && !m_poReader->HasStoppedParsing()) { throw SAXNotSupportedException("File probably corrupted (million laugh pattern)"); } }
void GMLXercesHandler::characters(const XMLCh* const chars_in, const XMLSize_t length ) { char* utf8String = tr_strdup(chars_in); int nLen = strlen(utf8String); OGRErr eErr = GMLHandler::dataHandler(utf8String, nLen); CPLFree(utf8String); if (eErr == CE_Failure) { throw SAXNotSupportedException("Out of memory"); } }
void GMLXercesHandler::endElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname ) { m_nEntityCounter = 0; if (GMLHandler::endElement() == OGRERR_NOT_ENOUGH_MEMORY) { throw SAXNotSupportedException("Out of memory"); } }
bool SAXParser::getFeature(const XMLString& featureId) const { if (featureId == XMLReader::FEATURE_VALIDATION || featureId == XMLReader::FEATURE_STRING_INTERNING) throw SAXNotSupportedException(fromXMLString(XMLReader::FEATURE_VALIDATION)); else if (featureId == XMLReader::FEATURE_EXTERNAL_GENERAL_ENTITIES) return _engine.getExternalGeneralEntities(); else if (featureId == XMLReader::FEATURE_EXTERNAL_PARAMETER_ENTITIES) return _engine.getExternalParameterEntities(); else if (featureId == XMLReader::FEATURE_NAMESPACES) return _namespaces; else if (featureId == XMLReader::FEATURE_NAMESPACE_PREFIXES) return _namespacePrefixes; else if (featureId == FEATURE_PARTIAL_READS) return _engine.getEnablePartialReads(); else throw SAXNotRecognizedException(fromXMLString(featureId)); }
void GMLXercesHandler::characters(const XMLCh* const chars_in, #if XERCES_VERSION_MAJOR >= 3 const XMLSize_t length #else const unsigned int length #endif ) { char* utf8String = tr_strdup(chars_in); int nLen = strlen(utf8String); OGRErr eErr = GMLHandler::dataHandler(utf8String, nLen); CPLFree(utf8String); if (eErr == OGRERR_NOT_ENOUGH_MEMORY) { throw SAXNotSupportedException("Out of memory"); } }