本文整理汇总了C++中XMLInputStream类的典型用法代码示例。如果您正苦于以下问题:C++ XMLInputStream类的具体用法?C++ XMLInputStream怎么用?C++ XMLInputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XMLInputStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: XMLNode
/*
* Reads other XML such as math/notes etc.
*/
bool
Uncertainty::readOtherXML(XMLInputStream& stream)
{
bool read = false;
const string& name = stream.peek().getName();
if (name == "UncertML")
{
const XMLToken& token = stream.next();
stream.skipText();
delete mUncertML;
XMLNode* xml = new XMLNode(stream);
mUncertML = new UncertMLNode(xml);
stream.skipPastEnd(token);
delete xml;
read = true;
}
if (SBase::readOtherXML(stream))
{
read = true;
}
return read;
}
开发者ID:hovo1990,项目名称:deviser,代码行数:28,代码来源:Uncertainty.cpp
示例2: determineNumChildren
bool
ArraysASTPlugin::readMatrixRow(XMLInputStream& stream, const std::string& reqd_prefix,
const XMLToken& currentElement)
{
bool read = false;
stream.skipText();
const XMLToken nextElement = stream.peek();
const string& nextName = nextElement.getName();
unsigned int numChildren = determineNumChildren(stream, "matrixrow");
mVector = new ASTArraysVectorFunctionNode(AST_LINEAR_ALGEBRA_MATRIXROW_CONSTRUCTOR);
mVector->setExpectedNumChildren(numChildren);
// read attributes on this element here since we have already consumed
// the element
ExpectedAttributes expectedAttributes;
mVector->addExpectedAttributes(expectedAttributes, stream);
read = mVector->ASTBase::readAttributes(currentElement.getAttributes(),
expectedAttributes, stream, currentElement);
if (read == false)
{
mVector = NULL;
}
else
{
read = mVector->read(stream, reqd_prefix);
}
return read;
}
开发者ID:kirichoi,项目名称:roadrunner,代码行数:33,代码来源:ArraysASTPlugin.cpp
示例3: setTypeCI
/**
* Sets the type of an ASTNode based on the given MathML <ci> element.
* Errors will be logged in the stream's SBMLErrorLog object.
*/
static void
setTypeCI (ASTNode& node, const XMLToken& element, XMLInputStream& stream)
{
if (element.getName() == "csymbol")
{
string url;
element.getAttributes().readInto("definitionURL", url);
if ( url == URL_DELAY ) node.setType(AST_FUNCTION_DELAY);
else if ( url == URL_TIME ) node.setType(AST_NAME_TIME);
else if ( url == URL_AVOGADRO ) node.setType(AST_NAME_AVOGADRO);
else
{
static_cast <SBMLErrorLog*>
(stream.getErrorLog())->logError(BadCsymbolDefinitionURLValue,
stream.getSBMLNamespaces()->getLevel(),
stream.getSBMLNamespaces()->getVersion());
}
}
else if (element.getName() == "ci")
{
node.setDefinitionURL(element.getAttributes());
}
const string name = trim( stream.next().getCharacters() );
node.setName( name.c_str() );
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:31,代码来源:MathML.cpp
示例4: addExpectedAttributes
bool
ASTCiNumberNode::read(XMLInputStream& stream, const std::string& reqd_prefix)
{
bool read = false;
const XMLToken element = stream.next ();
const string& nameE = element.getName();
ASTBase::checkPrefix(stream, reqd_prefix, element);
if (nameE != "ci")
{
#if 0
cout << "HELP\n";
#endif
return read;
}
ExpectedAttributes expectedAttributes;
addExpectedAttributes(expectedAttributes, stream);
read = readAttributes(element.getAttributes(), expectedAttributes,
stream, element);
const string name = trim( stream.next().getCharacters() );
setName((name));
ASTBase::setType(AST_NAME);
if (read == true)
stream.skipPastEnd(element);
return read;
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:32,代码来源:ASTCiNumberNode.cpp
示例5: addExpectedAttributes
bool
ASTCnBase::read(XMLInputStream& stream, const std::string& )
{
bool read = false;
const XMLToken element = stream.next ();
ExpectedAttributes expectedAttributes;
addExpectedAttributes(expectedAttributes, stream);
read = readAttributes(element.getAttributes(), expectedAttributes,
stream, element);
string prefix;
if (isSetUnits() == true)
{
prefix = element.getAttrPrefix(
element.getAttrIndex("units", stream.getSBMLNamespaces()->getURI()));
setUnitsPrefix(prefix);
}
//return ASTBase::read(stream, reqd_prefix);
return read;
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:25,代码来源:ASTCnBase.cpp
示例6: checkMathMLNamespace
bool
AnalyticVolume::readOtherXML (XMLInputStream& stream)
{
bool read = false;
const string& name = stream.peek().getName();
if (name == "math")
{
const XMLToken elem = stream.peek();
const std::string prefix = checkMathMLNamespace(elem);
if (stream.getSBMLNamespaces() == NULL)
{
stream.setSBMLNamespaces(new SBMLNamespaces(getLevel(), getVersion()));
}
delete mMath;
mMath = readMathML(stream, prefix);
read = true;
}
if (SBase::readOtherXML(stream))
{
read = true;
}
return read;
}
开发者ID:kirichoi,项目名称:roadrunner,代码行数:27,代码来源:AnalyticVolume.cpp
示例7:
void
ASTBase::logError (XMLInputStream& stream, const XMLToken& element, SBMLErrorCode_t code,
const std::string& msg)
{
SBMLNamespaces* ns = stream.getSBMLNamespaces();
if (ns != NULL)
{
static_cast <SBMLErrorLog*>
(stream.getErrorLog())->logError(
code,
ns->getLevel(),
ns->getVersion(),
msg,
element.getLine(),
element.getColumn());
}
else
{
static_cast <SBMLErrorLog*>
(stream.getErrorLog())->logError(
code,
SBML_DEFAULT_LEVEL,
SBML_DEFAULT_VERSION,
msg,
element.getLine(),
element.getColumn());
}
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:28,代码来源:ASTBase.cpp
示例8: setTypeCN
/**
* Sets the type of an ASTNode based on the given MathML <cn> element.
* Errors will be logged in the stream's SBMLErrorLog object.
*/
static void
setTypeCN (ASTNode& node, const XMLToken& element, XMLInputStream& stream)
{
string type = "real";
element.getAttributes().readInto("type", type);
// here is the only place we might encounter the sbml:units attribute
string units = "";
element.getAttributes().readInto("units", units);
if (type == "real")
{
double value = 0;
istringstream isreal;
isreal.str( stream.next().getCharacters() );
isreal >> value;
node.setValue(value);
if (isreal.fail()
|| node.isInfinity()
|| node.isNegInfinity()
)
{
static_cast <SBMLErrorLog*>
(stream.getErrorLog())->logError(FailedMathMLReadOfDouble,
stream.getSBMLNamespaces()->getLevel(),
stream.getSBMLNamespaces()->getVersion());
}
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:35,代码来源:MathML.cpp
示例9: logError
/*
* Subclasses should override this method to read (and store) XHTML,
* MathML, etc. directly from the XMLInputStream.
*
* @return true if the subclass read from the stream, false otherwise.
*/
bool
InitialAssignment::readOtherXML (XMLInputStream& stream)
{
bool read = false;
const string& name = stream.peek().getName();
if (name == "math")
{
// if this is level 1 there shouldnt be any math!!!
if (getLevel() == 1)
{
logError(NotSchemaConformant, getLevel(), getVersion(),
"SBML Level 1 does not support MathML.");
delete mMath;
return false;
}
if (mMath != NULL)
{
if (getLevel() < 3)
{
logError(NotSchemaConformant, getLevel(), getVersion(),
"Only one <math> element is permitted inside a "
"particular containing element.");
}
else
{
logError(OneMathElementPerInitialAssign, getLevel(), getVersion(),
"The <initialAssignment> with symbol '" + getSymbol() +
"' contains more than one <math> element.");
}
}
/* check for MathML namespace
* this may be explicitly declared here
* or implicitly declared on the whole document
*/
const XMLToken elem = stream.peek();
const std::string prefix = checkMathMLNamespace(elem);
delete mMath;
mMath = readMathML(stream, prefix);
if (mMath != NULL) mMath->setParentSBMLObject(this);
read = true;
}
/* ------------------------------
*
* (EXTENSION)
*
* ------------------------------ */
if ( SBase::readOtherXML(stream) )
read = true;
return read;
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:61,代码来源:InitialAssignment.cpp
示例10:
void
ASTCnBase::addExpectedAttributes(ExpectedAttributes& attributes,
XMLInputStream& stream)
{
ASTBase::addExpectedAttributes(attributes, stream);
if (stream.getSBMLNamespaces() != NULL
&& stream.getSBMLNamespaces()->getLevel() > 2)
{
attributes.add("units");
}
attributes.add("type");
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:14,代码来源:ASTCnBase.cpp
示例11: while
bool
ASTArraysVectorFunctionNode::read(XMLInputStream& stream, const std::string& reqd_prefix)
{
bool read = false;
ASTBase * child = NULL;
const XMLToken element = stream.peek ();
ASTBase::checkPrefix(stream, reqd_prefix, element);
const char* name;
unsigned int numChildrenAdded = 0;
while (stream.isGood() && numChildrenAdded < getExpectedNumChildren())// && stream.peek().isEndFor(element) == false)
{
stream.skipText();
name = stream.peek().getName().c_str();
if (representsNumber(ASTBase::getTypeFromName(name)) == true)
{
child = new ASTNumber();
}
else
{
child = new ASTFunction();
}
read = child->read(stream, reqd_prefix);
stream.skipText();
if (read == true && addChild(child) == LIBSBML_OPERATION_SUCCESS)
{
numChildrenAdded++;
}
else
{
read = false;
break;
}
}
if (getExpectedNumChildren() == 0 && numChildrenAdded == 0)
{
read = true;
}
return read;
}
开发者ID:TheCoSMoCompany,项目名称:biopredyn,代码行数:49,代码来源:ASTArraysVectorFunctionNode.cpp
示例12: if
bool
ArraysASTPlugin::read(XMLInputStream& stream, const std::string& reqd_prefix,
const XMLToken& currentElement)
{
bool read = false;
stream.skipText();
const string& currentName = currentElement.getName();
//ASTBase::checkPrefix(stream, reqd_prefix, currentElement);
// create appropriate sub class
if (currentName == "vector")
{
read = readVector(stream, reqd_prefix, currentElement);
}
#if (0)
else if (currentName == "matrix")
{
read = readMatrix(stream, reqd_prefix, currentElement);
}
else if (currentName == "matrixrow")
{
read = readMatrixRow(stream, reqd_prefix, currentElement);
}
#endif
return read;
}
开发者ID:kirichoi,项目名称:roadrunner,代码行数:30,代码来源:ArraysASTPlugin.cpp
示例13: ASTNumber
bool
ASTSemanticsNode::read(XMLInputStream& stream, const std::string& reqd_prefix)
{
bool read = false;
ASTBase * child = NULL;
const XMLToken element = stream.peek ();
ASTBase::checkPrefix(stream, reqd_prefix, element);
const char* name;// = element.getName().c_str();
if (stream.isGood())// && stream.peek().isEndFor(element) == false)
{
stream.skipText();
name = stream.peek().getName().c_str();
if (representsNumber(ASTBase::getTypeFromName(name)) == true)
{
child = new ASTNumber();
}
else
{
child = new ASTFunction();
}
read = child->read(stream, reqd_prefix);
stream.skipText();
if (read == false || addChild(child) != LIBSBML_OPERATION_SUCCESS)
{
delete child;
child = NULL;
read = false;
}
}
unsigned int i = 0;
while ( i < getNumAnnotations())
{
if (stream.peek().getName() == "annotation"
|| stream.peek().getName() == "annotation-xml")
{
XMLNode semanticAnnotation = XMLNode(stream);
addSemanticsAnnotation(semanticAnnotation.clone());
i++;
}
else
{
stream.next();
}
}
return true;
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:55,代码来源:ASTSemanticsNode.cpp
示例14: setReal
bool
ASTCnRealNode::read(XMLInputStream& stream, const std::string& reqd_prefix)
{
bool read = false;
const XMLToken element = stream.peek ();
const string& name = element.getName();
ASTBase::checkPrefix(stream, reqd_prefix, element);
if (name != "cn")
{
#if 0
cout << "HELP\n";
#endif
return read;
}
ASTCnBase::read(stream, reqd_prefix);
std::string type = "real";
element.getAttributes().readInto("type", type);
if (type == "real")
{
double value = 0;
istringstream isreal;
isreal.str( stream.next().getCharacters() );
isreal >> value;
setReal(value);
ASTBase::setType(AST_REAL);
if (isreal.fail()
|| (util_isInf(getValue()) > 0)
|| (util_isInf(getValue()) < 0)
)
{
logError(stream, element, FailedMathMLReadOfDouble);
}
read = true;
}
开发者ID:sn248,项目名称:Rcppsbml,代码行数:42,代码来源:ASTCnRealNode.cpp
示例15: readAttributes
bool
ASTBase::read(XMLInputStream& stream, const std::string& )
{
ExpectedAttributes expectedAttributes;
addExpectedAttributes(expectedAttributes, stream);
const XMLToken element = stream.next ();
return readAttributes(element.getAttributes(), expectedAttributes,
stream, element);
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:11,代码来源:ASTBase.cpp
示例16: if
bool
ASTCnIntegerNode::read(XMLInputStream& stream, const std::string& reqd_prefix)
{
bool read = false;
const XMLToken element = stream.peek ();
const string& name = element.getName();
ASTBase::checkPrefix(stream, reqd_prefix, element);
if (name != "cn")
{
cout << "HELP\n";
return read;
}
ASTCnBase::read(stream, reqd_prefix);
std::string type;
element.getAttributes().readInto("type", type);
if (type == "integer")
{
int value = 0;
istringstream isint;
isint.str( stream.next().getCharacters() );
isint >> value;
if (isint.fail())
{
logError(stream, element, FailedMathMLReadOfInteger);
}
else if ( sizeof(int) > 4 && ( (value > SBML_INT_MAX) || (value < SBML_INT_MIN) ) )
{
logError(stream, element, FailedMathMLReadOfInteger);
}
setInteger(value);
ASTBase::setType(AST_INTEGER);
read = true;
}
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:40,代码来源:ASTCnIntegerNode.cpp
示例17: logError
/*
* Subclasses should override this method to read (and store) XHTML,
* MathML, etc. directly from the XMLInputStream.
*
* @return true if the subclass read from the stream, false otherwise.
*/
bool
StoichiometryMath::readOtherXML (XMLInputStream& stream)
{
bool read = false;
const string& name = stream.peek().getName();
if (name == "math")
{
// if this is level 1 there shouldnt be any math!!!
if (getLevel() == 1)
{
logError(NotSchemaConformant, getLevel(), getVersion(),
"SBML Level 1 does not support MathML.");
delete mMath;
return false;
}
/* check for MathML namespace
* this may be explicitly declared here
* or implicitly declared on the whole document
*/
const XMLToken elem = stream.peek();
const std::string prefix = checkMathMLNamespace(elem);
delete mMath;
mMath = readMathML(stream, prefix);
if (mMath) mMath->setParentSBMLObject(this);
read = true;
}
/* ------------------------------
*
* (EXTENSION)
*
* ------------------------------ */
if ( SBase::readOtherXML(stream) )
read = true;
return read;
}
开发者ID:0u812,项目名称:libsbml.js.frozen,代码行数:46,代码来源:StoichiometryMath.cpp
示例18: XMLToken
/*
* Creates a new XMLNode by reading XMLTokens from stream. The stream must
* be positioned on a start element (stream.peek().isStart() == true) and
* will be read until the matching end element is found.
*/
XMLNode::XMLNode (XMLInputStream& stream) : XMLToken( stream.next() )
{
if ( isEnd() ) return;
std::string s;
while ( stream.isGood() )
{
const XMLToken& next = stream.peek();
if ( next.isStart() )
{
addChild( XMLNode(stream) );
}
else if ( next.isText() )
{
s = trim(next.getCharacters());
if (s != "")
addChild( stream.next() );
else
stream.skipText();
}
else if ( next.isEnd() )
{
stream.next();
break;
}
}
}
开发者ID:0u812,项目名称:libsbml.js.frozen,代码行数:35,代码来源:XMLNode.cpp
示例19: checkMathMLNamespace
bool
SedSetValue::readOtherXML (XMLInputStream& stream)
{
bool read = false;
const string& name = stream.peek().getName();
if (name == "math")
{
const XMLToken elem = stream.peek();
const std::string prefix = checkMathMLNamespace(elem);
delete mMath;
mMath = readMathML(stream, prefix);
read = true;
}
if (SedBase::readOtherXML(stream))
{
read = true;
}
return read;
}
开发者ID:jeicher,项目名称:libSEDML,代码行数:22,代码来源:SedSetValue.cpp
示例20:
bool
ASTCnExponentialNode::read(XMLInputStream& stream, const std::string& reqd_prefix)
{
bool read = false;
const XMLToken element = stream.peek ();
const string& name = element.getName();
ASTBase::checkPrefix(stream, reqd_prefix, element);
if (name != "cn")
{
#if 0
cout << "HELP\n";
#endif
return read;
}
ASTCnBase::read(stream, reqd_prefix);
std::string type;
element.getAttributes().readInto("type", type);
if (type == "e-notation")
{
double mantissa = 0;
long exponent = 0;
istringstream ismantissa;
istringstream isexponent;
ismantissa.str( stream.next().getCharacters() );
ismantissa >> mantissa;
if (stream.peek().getName() == "sep")
{
stream.next();
isexponent.str( stream.next().getCharacters() );
isexponent >> exponent;
}
开发者ID:0u812,项目名称:libsbml.js.frozen,代码行数:37,代码来源:ASTCnExponentialNode.cpp
注:本文中的XMLInputStream类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论