本文整理汇总了C++中CElement::fromXml方法的典型用法代码示例。如果您正苦于以下问题:C++ CElement::fromXml方法的具体用法?C++ CElement::fromXml怎么用?C++ CElement::fromXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CElement
的用法示例。
在下文中一共展示了CElement::fromXml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fromXml
bool CComponentLibrary::fromXml(const CXmlElement &xmlElement,
CXmlSerializingContext &serializingContext)
{
CXmlElement childElement;
CXmlElement::CChildIterator it(xmlElement);
// XML populate all component libraries
while (it.next(childElement)) {
// Filter component library/type set elements
if (childElement.getType() == "ComponentLibrary" ||
childElement.getType() == "ComponentTypeSet") {
if (!fromXml(childElement, serializingContext)) {
return false;
}
} else {
// Regular child creation and populating
CElement *pChild = createChild(childElement, serializingContext);
if (!pChild || !pChild->fromXml(childElement, serializingContext)) {
return false;
}
}
}
return true;
}
示例2: fromXml
// From IXmlSink
bool CElement::fromXml(const CXmlElement &xmlElement, CXmlSerializingContext &serializingContext)
{
xmlElement.getAttribute(gDescriptionPropertyName, _strDescription);
// Propagate through children
CXmlElement::CChildIterator childIterator(xmlElement);
CXmlElement childElement;
while (childIterator.next(childElement)) {
CElement *pChild;
if (!childrenAreDynamic()) {
pChild = findChildOfKind(childElement.getType());
if (!pChild) {
serializingContext.setError("Unable to handle XML element: " +
childElement.getPath());
return false;
}
} else {
// Child needs creation
pChild = createChild(childElement, serializingContext);
if (!pChild) {
return false;
}
}
// Dig
if (!pChild->fromXml(childElement, serializingContext)) {
return false;
}
}
return true;
}