本文整理汇总了C++中ThrowXMLwithMemMgr1函数的典型用法代码示例。如果您正苦于以下问题:C++ ThrowXMLwithMemMgr1函数的具体用法?C++ ThrowXMLwithMemMgr1怎么用?C++ ThrowXMLwithMemMgr1使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ThrowXMLwithMemMgr1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setWhiteSpace
// ---------------------------------------------------------------------------
// Utilities
// ---------------------------------------------------------------------------
void StringDatatypeValidator::assignAdditionalFacet(const XMLCh* const key
, const XMLCh* const value
, MemoryManager* const manager)
{
if (XMLString::equals(key, SchemaSymbols::fgELT_WHITESPACE))
{
// whiteSpace = preserve | replace | collapse
if (XMLString::equals(value, SchemaSymbols::fgWS_PRESERVE))
setWhiteSpace(DatatypeValidator::PRESERVE);
else if (XMLString::equals(value, SchemaSymbols::fgWS_REPLACE))
setWhiteSpace(DatatypeValidator::REPLACE);
else if (XMLString::equals(value, SchemaSymbols::fgWS_COLLAPSE))
setWhiteSpace(DatatypeValidator::COLLAPSE);
else
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_WS, value, manager);
//("whiteSpace value '" + ws + "' must be one of 'preserve', 'replace', 'collapse'.");
setFacetsDefined(DatatypeValidator::FACET_WHITESPACE);
}
else
{
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException
, XMLExcepts::FACET_Invalid_Tag
, key
, manager);
}
}
示例2: ThrowXMLwithMemMgr1
XERCES_CPP_NAMESPACE_BEGIN
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
BooleanDatatypeValidator::BooleanDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefArrayVectorOf<XMLCh>* const enums
, const int finalSet
, MemoryManager* const manager)
:DatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::Boolean, manager)
{
// Set Facets if any defined
if ( facets )
{
// Boolean shall NOT have enumeration
if (enums) {
delete enums;
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException
, XMLExcepts::FACET_Invalid_Tag
, "enumeration"
, manager);
}
XMLCh* key;
XMLCh* value;
RefHashTableOfEnumerator<KVStringPair> e(facets, false, manager);
while (e.hasMoreElements())
{
KVStringPair pair = e.nextElement();
key = pair.getKey();
value = pair.getValue();
if (XMLString::equals(key, SchemaSymbols::fgELT_PATTERN))
{
setPattern(value);
setFacetsDefined(DatatypeValidator::FACET_PATTERN);
}
else
{
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException
, XMLExcepts::FACET_Invalid_Tag
, key
, manager);
}
}
}// End of facet setting
}
示例3: catch
void DecimalDatatypeValidator::assignAdditionalFacet(const XMLCh* const key
, const XMLCh* const value
, MemoryManager* const manager)
{
if (XMLString::equals(key, SchemaSymbols::fgELT_TOTALDIGITS))
{
int val;
try
{
val = XMLString::parseInt(value, manager);
}
catch (NumberFormatException&)
{
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_TotalDigit, value, manager);
}
// check 4.3.11.c0 must: totalDigits > 0
if ( val <= 0 )
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_PosInt_TotalDigit, value, manager);
setTotalDigits(val);
setFacetsDefined(DatatypeValidator::FACET_TOTALDIGITS);
}
else if (XMLString::equals(key, SchemaSymbols::fgELT_FRACTIONDIGITS))
{
int val;
try
{
val = XMLString::parseInt(value, manager);
}
catch (NumberFormatException&)
{
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_FractDigit, value, manager);
}
// check 4.3.12.c0 must: fractionDigits > 0
if ( val < 0 )
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_NonNeg_FractDigit, value, manager);
setFractionDigits(val);
setFacetsDefined(DatatypeValidator::FACET_FRACTIONDIGITS);
}
else
{
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException
, XMLExcepts::FACET_Invalid_Tag
, key
, manager);
}
}
示例4: ThrowXMLwithMemMgr1
FileHandle XMLPlatformUtils::openStdInHandle(MemoryManager* const manager)
{
//
// Get the standard input handle. Duplicate it and return that copy
// since the outside world cannot tell the difference and will shut
// down this handle when its done with it. If we gave out the orignal,
// shutting it would prevent any further output.
//
HANDLE stdInOrg = ::GetStdHandle(STD_INPUT_HANDLE);
if (stdInOrg == INVALID_HANDLE_VALUE) {
XMLCh stdinStr[] = {chLatin_s, chLatin_t, chLatin_d, chLatin_i, chLatin_n, chNull};
ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, stdinStr, manager);
}
HANDLE retHandle;
if (!::DuplicateHandle
(
::GetCurrentProcess()
, stdInOrg
, ::GetCurrentProcess()
, &retHandle
, 0
, FALSE
, DUPLICATE_SAME_ACCESS))
{
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotDupHandle, manager);
}
return retHandle;
}
示例5: getEnumeration
void ListDatatypeValidator::inspectFacetBase(MemoryManager* const manager)
{
//
// we are pretty sure baseValidator is not null
//
if (getBaseValidator()->getType() == DatatypeValidator::List)
{
AbstractStringValidator::inspectFacetBase(manager);
}
else
{
// the first level ListDTV
// check 4.3.5.c0 must: enumeration values from the value space of base
if ( ((getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) != 0) &&
(getEnumeration() !=0) )
{
int i;
int enumLength = getEnumeration()->size();
try
{
for ( i = 0; i < enumLength; i++)
{
// ask the itemType for a complete check
BaseRefVectorOf<XMLCh>* tempList = XMLString::tokenizeString(getEnumeration()->elementAt(i), manager);
Janitor<BaseRefVectorOf<XMLCh> > jan(tempList);
int tokenNumber = tempList->size();
try
{
for ( int j = 0; j < tokenNumber; j++)
getBaseValidator()->validate(tempList->elementAt(j), (ValidationContext*)0, manager);
}
catch(const OutOfMemoryException&)
{
jan.release();
throw;
}
// enum shall pass this->checkContent() as well.
checkContent(getEnumeration()->elementAt(i), (ValidationContext*)0, false, manager);
}
}
catch ( XMLException& )
{
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException
, XMLExcepts::FACET_enum_base
, getEnumeration()->elementAt(i)
, manager);
}
}
}
}// End of inspectFacetBase()
示例6: ThrowXMLwithMemMgr1
// ---------------------------------------------------------------------------
// RangeTokenMap: Setter methods
// ---------------------------------------------------------------------------
void RangeTokenMap::setRangeToken(const XMLCh* const keyword,
RangeToken* const tok,const bool complement) {
if (fTokenRegistry->containsKey(keyword)) {
fTokenRegistry->get(keyword)->setRangeToken(tok, complement);
}
else {
ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Regex_KeywordNotFound, keyword, fTokenRegistry->getMemoryManager());
}
}
示例7: ThrowXMLwithMemMgr1
void
RegularExpression::staticInitialize(MemoryManager* memoryManager)
{
fWordRange = TokenFactory::staticGetRange(fgUniIsWord, false);
if (fWordRange == 0)
ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Regex_RangeTokenGetError, fgUniIsWord, memoryManager);
WordRangeCleanup.registerCleanup(localCleanup);
}
示例8: getFacetsDefined
void NOTATIONDatatypeValidator::checkContent( const XMLCh* const content
, ValidationContext* const context
, bool asBase
, MemoryManager* const manager
)
{
//validate against base validator if any
NOTATIONDatatypeValidator *pBaseValidator = (NOTATIONDatatypeValidator*) this->getBaseValidator();
if (pBaseValidator)
pBaseValidator->checkContent(content, context, true, manager);
int thisFacetsDefined = getFacetsDefined();
// we check pattern first
if ( (thisFacetsDefined & DatatypeValidator::FACET_PATTERN ) != 0 )
{
if (getRegex()->matches(content, manager) ==false)
{
ThrowXMLwithMemMgr2(InvalidDatatypeValueException
, XMLExcepts::VALUE_NotMatch_Pattern
, content
, getPattern()
, manager);
}
}
// if this is a base validator, we only need to check pattern facet
// all other facet were inherited by the derived type
if (asBase)
return;
checkValueSpace(content, manager);
if ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0 &&
(getEnumeration() != 0))
{
XMLCh* normContent = XMLString::replicate(content, manager);
ArrayJanitor<XMLCh> jan(normContent, manager);
normalizeContent(normContent, manager);
int i=0;
int enumLength = getEnumeration()->size();
for ( ; i < enumLength; i++)
{
if (XMLString::equals(normContent, getEnumeration()->elementAt(i)))
break;
}
if (i == enumLength)
ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager);
}
checkAdditionalFacet(content, manager);
}
示例9: fEscapeFlags
XMLFormatter::XMLFormatter( const char* const outEncoding
, XMLFormatTarget* const target
, const EscapeFlags escapeFlags
, const UnRepFlags unrepFlags
, MemoryManager* const manager)
: fEscapeFlags(escapeFlags)
, fOutEncoding(0)
, fTarget(target)
, fUnRepFlags(unrepFlags)
, fXCoder(0)
, fAposRef(0)
, fAposLen(0)
, fAmpRef(0)
, fAmpLen(0)
, fGTRef(0)
, fGTLen(0)
, fLTRef(0)
, fLTLen(0)
, fQuoteRef(0)
, fQuoteLen(0)
, fIsXML11(false)
, fMemoryManager(manager)
{
// this constructor uses "1.0" for the docVersion
// Transcode the encoding string
fOutEncoding = XMLString::transcode(outEncoding, fMemoryManager);
// Try to create a transcoder for this encoding
XMLTransService::Codes resCode;
fXCoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor
(
fOutEncoding
, resCode
, kTmpBufSize
, fMemoryManager
);
if (!fXCoder)
{
fMemoryManager->deallocate(fOutEncoding); //delete [] fOutEncoding;
ThrowXMLwithMemMgr1
(
TranscodingException
, XMLExcepts::Trans_CantCreateCvtrFor
, outEncoding
, fMemoryManager
);
}
//XMLCh* const tmpDocVer = XMLString::transcode("1.0", fMemoryManager);
//ArrayJanitor<XMLCh> jname(tmpDocVer, fMemoryManager);
//fIsXML11 = XMLString::equals(tmpDocVer, XMLUni::fgVersion1_1);
fIsXML11 = false; // docVersion 1.0 is not 1.1!
}
示例10: ThrowXMLwithMemMgr
UnionDatatypeValidator::UnionDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefArrayVectorOf<XMLCh>* const enums
, const int finalSet
, MemoryManager* const manager
, RefVectorOf<DatatypeValidator>* const memberTypeValidators
, const bool memberTypesInherited
)
:DatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::Union, manager)
,fEnumerationInherited(false)
,fMemberTypesInherited(memberTypesInherited)
,fEnumeration(0)
,fMemberTypeValidators(memberTypeValidators)
,fValidatedDatatype(0)
{
//
// baseValidator another UnionDTV from which,
// this UnionDTV is derived by restriction.
// it shall be not null
//
if (!baseValidator)
{
ThrowXMLwithMemMgr(InvalidDatatypeFacetException
, XMLExcepts::FACET_Union_Null_baseValidator, manager);
}
if (baseValidator->getType() != DatatypeValidator::Union)
{
XMLCh value1[BUF_LEN+1];
XMLString::binToText(baseValidator->getType(), value1, BUF_LEN, 10, manager);
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException
, XMLExcepts::FACET_Union_invalid_baseValidatorType
, value1
, manager);
}
CleanupType cleanup(this, &UnionDatatypeValidator::cleanUp);
try
{
init(baseValidator, facets, enums, manager);
}
catch(const OutOfMemoryException&)
{
// Don't cleanup when out of memory, since executing the
// code can cause problems.
cleanup.release();
throw;
}
cleanup.release();
}
示例11: ThrowXMLwithMemMgr1
void HexBinaryDatatypeValidator::checkValueSpace(const XMLCh* const content,
MemoryManager* const manager)
{
if (HexBin::getDataLength(content) < 0)
{
ThrowXMLwithMemMgr1(InvalidDatatypeValueException
, XMLExcepts::VALUE_Not_HexBin
, content
, manager);
}
}
示例12: ThrowXMLwithMemMgr1
void StringDatatypeValidator::checkAdditionalFacet(const XMLCh* const content
, MemoryManager* const manager) const
{
//
// check WhiteSpace
//
if ((getFacetsDefined() & DatatypeValidator::FACET_WHITESPACE) != 0 )
{
if ( getWSFacet() == DatatypeValidator::REPLACE )
{
if (!XMLString::isWSReplaced(content))
ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_WS_replaced, content, manager);
}
else if ( getWSFacet() == DatatypeValidator::COLLAPSE )
{
if (!XMLString::isWSCollapsed(content))
ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_WS_collapsed, content, manager);
}
}
}
示例13: encoded
void AnyURIDatatypeValidator::checkValueSpace(const XMLCh* const content
, MemoryManager* const manager)
{
bool validURI = true;
// check 3.2.17.c0 must: URI (rfc 2396/2723)
try
{
// Support for relative URLs
// According to Java 1.1: URLs may also be specified with a
// String and the URL object that it is related to.
//
XMLSize_t len = XMLString::stringLen(content);
if (len)
{
// Encode special characters using XLink 5.4 algorithm
XMLBuffer encoded((len*3)+1, manager);
encode(content, len, encoded, manager);
validURI = XMLUri::isValidURI(true, encoded.getRawBuffer(), true);
}
}
catch(const OutOfMemoryException&)
{
throw;
}
catch (...)
{
ThrowXMLwithMemMgr1(InvalidDatatypeValueException
, XMLExcepts::VALUE_URI_Malformed
, content
, manager);
}
if (!validURI) {
ThrowXMLwithMemMgr1(InvalidDatatypeValueException
, XMLExcepts::VALUE_URI_Malformed
, content
, manager);
}
}
示例14: getBaseValidator
void DoubleDatatypeValidator::setEnumeration(MemoryManager* const manager)
{
// check 4.3.5.c0 must: enumeration values from the value space of base
//
// 1. shall be from base value space
// 2. shall be from current value space as well ( shall go through boundsCheck() )
//
if (!fStrEnumeration)
return;
XMLSize_t i = 0;
XMLSize_t enumLength = fStrEnumeration->size();
DoubleDatatypeValidator *numBase = (DoubleDatatypeValidator*) getBaseValidator();
if (numBase)
{
try
{
for ( i = 0; i < enumLength; i++)
{
numBase->checkContent(fStrEnumeration->elementAt(i), (ValidationContext*)0, false, manager);
}
}
catch (XMLException&)
{
ThrowXMLwithMemMgr1(InvalidDatatypeFacetException
, XMLExcepts::FACET_enum_base
, fStrEnumeration->elementAt(i)
, manager);
}
}
#if 0
// spec says that only base has to checkContent
// We put the this->checkContent in a separate loop
// to not block original message with in that method.
//
for ( i = 0; i < enumLength; i++)
{
checkContent(fStrEnumeration->elementAt(i), (ValidationContext*)0, false, manager);
}
#endif
fEnumeration = new (manager) RefVectorOf<XMLNumber>(enumLength, true, manager);
fEnumerationInherited = false;
for ( i = 0; i < enumLength; i++)
{
fEnumeration->insertElementAt(new (manager) XMLDouble(fStrEnumeration->elementAt(i), manager), i);
}
}
示例15: ThrowXMLwithMemMgr1
void NOTATIONDatatypeValidator::checkValueSpace(const XMLCh* const content
, MemoryManager* const manager)
{
if (!XMLString::isValidNOTATION(content, manager))
{
ThrowXMLwithMemMgr1(InvalidDatatypeValueException
, XMLExcepts::VALUE_NOTATION_Invalid
, content
, manager);
}
}