本文整理汇总了C++中XMLNamespaces::add方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLNamespaces::add方法的具体用法?C++ XMLNamespaces::add怎么用?C++ XMLNamespaces::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLNamespaces
的用法示例。
在下文中一共展示了XMLNamespaces::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/*
*
* Subclasses should override this method to write their xmlns attriubutes
* (if any) to the XMLOutputStream. Be sure to call your parents implementation
* of this method as well.
*
*/
void
SedDocument::writeXMLNS (XMLOutputStream& stream) const
{
// need to check that we have indeed a namespace set!
XMLNamespaces * thisNs = this->getNamespaces();
// the sbml namespace is missing - add it
if (thisNs == NULL)
{
XMLNamespaces xmlns;
xmlns.add(SEDML_XMLNS_L1);
mSedNamespaces->setNamespaces(&xmlns);
thisNs = getNamespaces();
}
else if (thisNs->getLength() == 0)
{
thisNs->add(SEDML_XMLNS_L1);
}
else
{
// check that there is an sbml namespace
std::string sedmlURI = SedNamespaces::getSedNamespaceURI(mLevel, mVersion);
std::string sedmlPrefix = thisNs->getPrefix(sedmlURI);
if (thisNs->hasNS(sedmlURI, sedmlPrefix) == false)
{
// the sbml ns is not present
std::string other = thisNs->getURI(sedmlPrefix);
if (other.empty() == false)
{
// there is another ns with the prefix that the sbml ns expects to have
//remove the this ns, add the sbml ns and
//add the new ns with a new prefix
thisNs->remove(sedmlPrefix);
thisNs->add(sedmlURI, sedmlPrefix);
thisNs->add(other, "addedPrefix");
}
else
{
thisNs->add(sedmlURI, sedmlPrefix);
}
}
}
XMLNamespaces * xmlns = thisNs->clone();
if (xmlns != NULL)
{
stream << *(xmlns);
delete xmlns;
}
}
示例2:
void
RenderCubicBezier::writeXMLNS (XMLOutputStream& stream) const
{
XMLNamespaces xmlns;
xmlns.add(LayoutExtension::getXmlnsXSI(), "xsi");
stream << xmlns;
}
示例3:
/*
* Subclasses should override this method to write their XML attributes
* to the XMLOutputStream. Be sure to call your parents implementation
* of this method as well.
*/
void
NUMLDocument::writeAttributes (XMLOutputStream& stream) const
{
if (mNUMLNamespaces->getNamespaces() == 0)
{
XMLNamespaces xmlns;
if (mLevel == 1)
{
xmlns.add("http://www.numl.org/numl/level1/version1");
}
stream << xmlns;
mNUMLNamespaces->setNamespaces(&xmlns);
}
NMBase::writeAttributes(stream);
//
// level: positiveInteger { use="required" fixed="1" } (L1v1)
stream.writeAttribute("level", mLevel);
stream.writeAttribute("version", mVersion);
}
示例4: getPrefix
/** @cond doxygenLibsbmlInternal */
void
ListOfGlobalRenderInformation::writeXMLNS (XMLOutputStream& stream) const
{
XMLNamespaces xmlns;
xmlns.add(getURI(), getPrefix());
stream << xmlns;
}
示例5: getPrefix
/*
* Write the namespace for the Sed package.
*/
void
SedListOfChanges::writeXMLNS(XMLOutputStream& stream) const
{
XMLNamespaces xmlns;
std::string prefix = getPrefix();
if (prefix.empty())
{
if (getNamespaces() != NULL && !getNamespaces()->hasURI(SEDML_XMLNS_L1) && !getNamespaces()->hasURI(SEDML_XMLNS_L1V2))
{
if (getVersion() == 2) xmlns.add(SEDML_XMLNS_L1V2,prefix);
else xmlns.add(SEDML_XMLNS_L1V2,prefix);
}
}
stream << xmlns;
}
示例6: getPrefix
/*
* Writes the namespace for the Render package
*/
void
ListOfGlobalRenderInformation::writeXMLNS(XMLOutputStream& stream) const
{
XMLNamespaces xmlns;
std::string prefix = getPrefix();
if (prefix.empty())
{
const XMLNamespaces* thisxmlns = getNamespaces();
if (thisxmlns && thisxmlns->hasURI(RenderExtension::getXmlnsL3V1V1()))
{
xmlns.add(RenderExtension::getXmlnsL3V1V1(), prefix);
}
}
else
{
xmlns.add(getURI(), getPrefix());
}
stream << xmlns;
}
示例7: getPrefix
/*
* Writes the namespace for the Spatial package
*/
void
ListOfCoordinateComponents::writeXMLNS(XMLOutputStream& stream) const
{
XMLNamespaces xmlns;
std::string prefix = getPrefix();
if (prefix.empty())
{
const XMLNamespaces* thisxmlns = getNamespaces();
if (thisxmlns && thisxmlns->hasURI(SpatialExtension::getXmlnsL3V1V1()))
{
xmlns.add(SpatialExtension::getXmlnsL3V1V1(), prefix);
}
}
stream << xmlns;
}
示例8: parseLayoutId
/*
* Creates an XMLNode that represents the layoutId annotation of the species reference from the given SpeciesReference object.
*
* (TODO)
*
*/
LIBSBML_EXTERN
XMLNode* parseLayoutId(const SimpleSpeciesReference* sr)
{
if (!sr || !sr->isSetId()) return 0;
XMLToken ann_token = XMLToken(XMLTriple("annotation", "", ""), XMLAttributes());
XMLNode* pNode = new XMLNode(ann_token);
XMLNamespaces xmlns = XMLNamespaces();
xmlns.add("http://projects.eml.org/bcb/sbml/level2", "");
XMLTriple triple = XMLTriple("layoutId", "", "");
XMLAttributes id_att = XMLAttributes();
id_att.add("id", sr->getId());
XMLToken token = XMLToken(triple, id_att, xmlns);
XMLNode node(token);
pNode->addChild(node);
return pNode;
}
示例9: getPrefix
/*
* Writes the namespace for the Groups package
*/
void
ListOfGroups::writeXMLNS(XMLOutputStream& stream) const
{
XMLNamespaces xmlns;
std::string prefix = getPrefix();
if (prefix.empty())
{
XMLNamespaces* thisxmlns = getNamespaces();
if (thisxmlns && thisxmlns->hasURI(GroupsExtension::getXmlnsL3V1V1()))
{
xmlns.add(GroupsExtension::getXmlnsL3V1V1(), prefix);
}
}
stream << xmlns;
}
示例10: getPrefix
/** @cond doxygenLibsbmlInternal */
void
ListOfExternalModelDefinitions::writeXMLNS (XMLOutputStream& stream) const
{
XMLNamespaces xmlns;
std::string prefix = getPrefix();
if (prefix.empty())
{
if (getNamespaces()->hasURI(CompExtension::getXmlnsL3V1V1()))
{
xmlns.add(CompExtension::getXmlnsL3V1V1(),prefix);
}
}
stream << xmlns;
}
示例11: getPrefix
/** @cond doxygenLibsbmlInternal */
void
ListOfFluxBounds::writeXMLNS (XMLOutputStream& stream) const
{
XMLNamespaces xmlns;
std::string prefix = getPrefix();
if (prefix.empty())
{
if (getNamespaces()->hasURI(FbcExtension::getXmlnsL3V1V1()))
{
xmlns.add(FbcExtension::getXmlnsL3V1V1(),prefix);
}
}
stream << xmlns;
}
示例12: getPrefix
/*
* Write the namespace for the Sed package.
*/
void
SedListOfTasks::writeXMLNS(XMLOutputStream& stream) const
{
XMLNamespaces xmlns;
std::string prefix = getPrefix();
if (prefix.empty())
{
if (getNamespaces() != NULL && !getNamespaces()->hasURI(SEDML_XMLNS_L1))
{
xmlns.add(SEDML_XMLNS_L1,prefix);
}
}
stream << xmlns;
}
示例13: getPrefix
/*
* Write the namespace for the Multi package.
*/
void
ListOfSpeciesTypeComponentMapInProducts::writeXMLNS(XMLOutputStream& stream) const
{
XMLNamespaces xmlns;
std::string prefix = getPrefix();
if (prefix.empty())
{
XMLNamespaces* thisxmlns = getNamespaces();
if (thisxmlns && thisxmlns->hasURI(MultiExtension::getXmlnsL3V1V1()))
{
xmlns.add(MultiExtension::getXmlnsL3V1V1(),prefix);
}
}
stream << xmlns;
}
示例14: XMLNamespaces
XMLNode*
UncertMLNode::constructXMLNode() const
{
/* create the top level UncertML element */
/* create Namespaces*/
XMLNamespaces xmlns = XMLNamespaces();
xmlns.add("http://www.uncertml.org/3.0");
XMLTriple top_triple = XMLTriple("UncertML",
"http://www.uncertml.org/3.0", "");
XMLAttributes blank_att = XMLAttributes();
XMLNode * xml = new XMLNode(top_triple, blank_att, xmlns);
xml->addChild(*(reconstructXML()));
return xml;
}
示例15: getXmlNodeForSBase
LIBSBML_EXTERN XMLNode getXmlNodeForSBase(const SBase* object)
{
char* rawsbml = const_cast<SBase*>(object)->toSBML();
SBMLNamespaces *sbmlns = object->getSBMLNamespaces();
XMLNamespaces* xmlns = sbmlns->getNamespaces()->clone();
// in rare cases the above returns a package element with default namespace, however the
// XMLNamespaces would then assign the actual default namespace, which is in most cases
// the SBML namespace. In that case we adjust the default namespace here
ISBMLExtensionNamespaces *extns = dynamic_cast<ISBMLExtensionNamespaces*>(sbmlns);
if (extns != NULL)
{
xmlns->remove("");
xmlns->add(xmlns->getURI(extns->getPackageName()), "");
}
XMLNode* tmp = XMLNode::convertStringToXMLNode(rawsbml, xmlns);
if (tmp == NULL) return XMLNode();
XMLNode result(*tmp);
delete tmp;
delete xmlns;
free(rawsbml);
return result;
}