本文整理汇总了C++中XmlAttribute::setBool方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlAttribute::setBool方法的具体用法?C++ XmlAttribute::setBool怎么用?C++ XmlAttribute::setBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlAttribute
的用法示例。
在下文中一共展示了XmlAttribute::setBool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseNodeStruct
///////////////////////////////////////////////////////////////////////////////////////////////////
//parse data schema from node
//src data node
//dst schema node
bool XmlSchema::parseNodeStruct(XmlNode* dst, XmlNode* src)
{
assert(dst != NULL);
assert(src != NULL);
NodeIterator nodeIterator;
AttributeIterator attriIterator;
for (XmlAttribute* attribute = src->getFirstAttribute(attriIterator);
attribute != NULL;
attribute = src->getNextAttribute(attriIterator))
{
XmlNode* structure = dst->findChild(attribute->getName());
if (structure == NULL)
{
//first time show up
structure = dst->addChild(attribute->getName());
structure->addAttribute(ATTR_TYPE, guessType(attribute->getString()));
structure->addAttribute(ATTR_ATTRIBUTE, T("true"));
}
}
for (XmlNode* child = src->getFirstChild(nodeIterator);
child != NULL;
child = src->getNextChild(nodeIterator))
{
if (child->getType() != ELEMENT)
{
continue;
}
XmlNode* structure = dst->findChild(child->getName());
if (structure == NULL)
{
//first time show up
bool recursive = false;
const XmlNode* parent = dst;
while (parent != NULL)
{
if (Strcmp(parent->getName(), child->getName()) == 0)
{
recursive = true;
break;
}
parent = parent->getParent();
}
structure = dst->addChild(child->getName());
if (recursive)
{
structure->addAttribute(ATTR_RECURSIVE, T("true"));
}
else if (!child->hasChild() && !child->hasAttribute())
{
//simple type, must have a type attribute
structure->addAttribute(ATTR_TYPE, guessType(child->getString()));
}
}
else if (structure->findAttribute(ATTR_ATTRIBUTE) != NULL)
{
//child and attribute can't have same name
return false;
}
XmlAttribute* multiple = structure->findAttribute(ATTR_MULTIPLE);
if (multiple == NULL || !multiple->getBool())
{
NodeIterator iter;
if (src->findFirstChild(child->getName(), iter) != NULL
&& src->findNextChild(child->getName(), iter) != NULL)
{
if (multiple == NULL)
{
multiple = structure->addAttribute(ATTR_MULTIPLE);
}
multiple->setBool(true);
}
}
if (!structure->findAttribute(ATTR_RECURSIVE) && (child->hasChild() || child->hasAttribute()))
{
parseNodeStruct(structure, child);
}
}
return true;
}